Sometime Today, Linux @ Ramshyam assembled some asciibets to say:
How can I search for a value of a variable [ f I may call iso] in a given file....
There's a program called grep :-P that does this. man grep
Say I have file ... \root\sandeep\log111.txt This files has a lot of text and one particulr line is ..... ##Date 24-07-2001
Now
- I need to locate the line "##Date" in the above file
- I then need to store the date value "24-07.2001" in a variable.
After you get the line, use cut to get the relevant part. The entire script follows:
VAR=$( cat filename | grep "##Date [0-3]?[1-9]-[01]?[1-9]-200[01]" | cut -f2 -d" " )
Note, all the above is on one line.
I have used a very generic date grep. This will also find invalid dates, but if you're sure that all the dates are valid and that the format is exactly as given above, then this will work.
Philip