aspose file tools*
The moose likes Linux / UNIX and the fly likes grep related question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "grep related question" Watch "grep related question" New topic
Author

grep related question

Sujoy Choudhury
Ranch Hand

Joined: Sep 17, 2008
Posts: 136

Hi,

I am trying to find a particulat line from a file.
My ksh code as below


But this doesn't evaluate $KEY so doesn't return any line.
How can I achieve that?

Thanks and Regards,
~Sujoy
Sujoy Choudhury
Ranch Hand

Joined: Sep 17, 2008
Posts: 136

I could figure this out, the solution is:

`grep '^'"$KEY"'_somestring' someFile.txt | awk -F= '{print $2}'`


Anand Hariharan
Rancher

Joined: Aug 22, 2006
Posts: 257

You don't need to grep and pipe it to awk. This -

- should suffice.


"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: grep related question