Computing.Net > Forums > Unix > sed remove chars

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

sed remove chars

Reply to Message Icon

Name: titsataki
Date: January 20, 2005 at 16:17:35 Pacific
OS: HP-UX 11i
CPU/Ram: 8/8Gb
Comment:

Hi everybody,

I have a text file with 3.5 mil lines. Each line has 100 characters (blanks, upper case numbers etc...) I would like to remove the first 50 characters of each line and the last 43 characters. that would leave the middle 7 characters. Or on the other had to pick characters 50-57 of each line and output it to a file. There is no real pattern to match here except that each line has 100 characters. Can it be done via sed?

Regards

Nick



Sponsored Link
Ads by Google

Response Number 1
Name: Jim Boothe
Date: January 20, 2005 at 16:24:12 Pacific
Reply:

It would be a bit easier with cut:

cut -c50-57 filein > fileout


0

Response Number 2
Name: titsataki
Date: January 20, 2005 at 16:36:20 Pacific
Reply:

Dooh..
I was looking for something complicated but the cut command never crossed my mind.

Much appreciated Jim

Regards

Nick


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: sed remove chars

removing char from line www.computing.net/answers/unix/removing-char-from-line/7572.html

UNIX Sed remove add www.computing.net/answers/unix/unix-sed-remove-add/7205.html

sed:remove a trailing string www.computing.net/answers/unix/sedremove-a-trailing-string/7689.html