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!

Retrieve first 30 characters

Status
Not open for further replies.

dmjoen

Technical User
Jul 26, 2001
31
US
Hi,

I'm looking for a method to retrieve the first 30 characters from every line in a file. I'm guessing maybe sed could accomplish this, but I'm taking the easy route and asking you the experts. Any help is greatly appreciated.

Thanks!
 
Hi

Of course, is better to do as elgrandeperro suggested. I post this just to confirm that you guessed correctly, it can also be solved with [tt]sed[/tt] :
Code:
sed 's/\(.\{30\}\).*/\1/' FILENAME
Tested with GNU [tt]sed[/tt].

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top