• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extracting pattern only with AWK or SED

 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have the following statement working, but when we move the program to Solaris 10 it fails.



How can we use AWK or SED to extract only the 6 digit number from the string?

The following outputs the entire string. We only want the 6 digit number.




Thanks.
[ August 21, 2008: Message edited by: James Clark ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34229
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,
Take a look at the print section of this tutorial. It shows how to use the longer form of awk to just print out a specific argument. The short form that you are using prints out the whole line.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you much.

Below are sed commands that do the trick.



Or

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic