Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving data from between characters in file 1

Status
Not open for further replies.

keithlages

IS-IT--Management
Feb 7, 2002
35
US
I need help retrieving just the number thats in a line between certain characters.

I can take the file, fold it to get my lines, then tail it to get the bottom lines and grep out the line I need:

example: GE*184*23058967

What I really need now is a way to get what is between 'GE*' and the second '*'. I need the '184' basically.

I'm a little lost using awk and I could really use some help here.
 
A starting point:
sed -n '/GE\*/s!.*GE\*\([^*]*\)\*.*!\1!p' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
point given to hoinz!

that was what i needed! i think sed and awk might be a little over my head for now.

cut is my new best friend!!
here it is:
# fold tesfile | tail testfile | grep GE | cut -f 2 -d "*"
183


perfect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top