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!

grabbing just a bit of a line of text

Status
Not open for further replies.

maddave

Technical User
Jan 3, 2002
72
GB
I have a file with one line in it. The line says:

"spcc123.dbf"

How can I just extract the number of this line?

I want to string out this line and just read from the 5th character to the charater before the full stop. I cant work out whats the best way to do it.
 
Just my 2 cents:
tr -dc '[:digit:]\n' < /input/file

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Burrrrrilliant! Many thanks. I was looking at the tr function in my manual, but it helpfully only includes a few of the options so didn't think there was anymore to it than just replacing characters.

Thanks.
 
Tip: man tr

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top