H!.....

Can anybody tell me about retrieving lines from file
I am working in linux ... And I have one File with some data in it
like

Filename: Sumit

...info about file
...

FileName: Mahamuni
...info about file
...


like above .. i wanna retrive filename & its info
Please tell me how can I do it ...?????

Hello,

Normally in this type of situation I say use "grep" to pull individual lines on a specific file. To get all lines and just the first two fields use "awk". But they only work if the data is on the same line as the information you are looking for.

If your file was in the format:

FileName: <actual file name>:Data about file

The awk command would look like:

awk -F: '{ print $2 " " $3 }'

-F: tells it the field separator
print $2 " " $3 tells it to print the second and third fields and the empty quotes put a space between them.

Hope that helps.