Results 1 to 7 of 7
Hi,
I have following row in a file (this file conatins only one row)
No.of.rows|9
I need to get number i.e '9' from the above line.More specifically, I need to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-22-2007 #1Just Joined!
- Join Date
- Feb 2007
- Posts
- 18
Help in grep command
Hi,
I have following row in a file (this file conatins only one row)
No.of.rows|9
I need to get number i.e '9' from the above line.More specifically, I need to get value after the '|'(pipe) delimiter.
Could you please help me how to get that number from the file.
Thanks in advance!
Regards,
Vishnu
- 03-22-2007 #2Just Joined!
- Join Date
- Dec 2006
- Posts
- 52
Use awk:
awk -F | '{ print $2}'
- 03-22-2007 #3Just Joined!
- Join Date
- Feb 2007
- Posts
- 18
Hi ,
I am using footer.txt file which consist of the
No.of.rows|9
row
As per your suggastion am using the command like
footer.txt | awk -F | '{ print $2}'
but its throwing an error.
Could you please help me out here!
Thanks and Regards,
Vishnu.
- 03-22-2007 #4Linux User
- Join Date
- Aug 2006
- Posts
- 458
its like this
Originally Posted by GVishnu
Code:awk -F | '{ print $2}' footer.txt
- 03-22-2007 #5Just Joined!
- Join Date
- Feb 2007
- Posts
- 18
Hi,
According to your suggastion I tested in the server where the footer file exists but its throwing an error like
[root@cognos.int.pic paymaster]# awk -F | '{ print $2}' footer.txt
-bash: { print $2}: command not found
awk: option requires an argument --
could you please help me out
Many Thanks,
- 03-22-2007 #6Linux User
- Join Date
- Aug 2006
- Posts
- 458
sorry pls try this
Originally Posted by GVishnu
Code:awk -F "|" '{ print $2}' footer.txt
- 03-22-2007 #7Just Joined!
- Join Date
- Feb 2007
- Posts
- 18
Thank you very much !! Its working fine.
Kind Regards,
Vishnu.


Reply With Quote
