Extracting particular column value
HI Guys
I need little help.Consider that i have a file which contain multiple lines .In each line there is one particular field which has some value.I just want to extract that value and place that in a new file.The example of the line is given below service: month day time info: somethink : client in something 1 staright service=something secured ip=8990000 ip=989898 resp=hsdakhhsd87e734hkdh387374 This whole is in one line and the value i want to fetch is of resp. Please guide me Regard Talat |
Something like this should work:
Code:
while read line ; |
Code:
egrep -o "resp=.*" file > newfile Cheers, Tink |
put in some effort next time.
Code:
# awk '{print $NF}' file |
As much to type as my solution, and quite likely slower.
Cheers, Tink |
Many Thanks guys
|
Hi Guys
After extracting the resp value and placing the value in another file, i am now trying to decode the value by mmencode tool.But when i run the cmd mmencode -u file -o output file What i get in the output file is the decoded value of only first line or you can say only one decode value .Tell me is this mmencode run only for the first line ?. If yes do i have any alternative ?. Regard Talat |
I've never come across mmencode ... what does it do? If it
can't handle your file, throw the content at it via xargs? cat file2 | xargs -i mmencode ...{} Where {} is a placeholder for each individual line from the file that you created in the first step. Cheers, Tink |
Quote:
|
That'll depend on the version of xargs... the ones in Solaris for
instance don't. Cheers, Tink |
Quote:
|
Quote:
Which one? :} The /usr/bin/egrep doesn't. The /usr/sfw/bin/gegrep does in Sol10, doesn't in Sol9... Cheers, Tink |
Hi Guys
I have been able to decode all line via while read line; do echo $line | /usr/bin/mimencode -u >> outputfile; echo "\n" >> outputfile ; done < inputfile Thanks & Regard Talat |
All times are GMT -5. The time now is 06:01 AM. |