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!

last position 1

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
ES
Hi,
How can I delete the last position of the a column efficiently?
For example, if my input is:
12350 a
2361 bc
655594 h
...

my output should be as:

1235 a
236 bc
65559 h

Thanks.
 
sed 's!. ! !' input > output

If the column separator is a tabulation, replace each space with a tab char.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi,
My sed command, don't have option s.
When I execute sed 's!. ! !' input > output, I've:
sed: -e expression #1, char 6: unknown option to `s'

Thanks.
 
Which flavor of *nix ?
What about this ?
sed 's/. / /' input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
It is OK, but if I want to delete the last position of last column (the last column didn't have space or tab).
How can I delete it in this situation?

Thanks.
 
sed 's/.$//' input > output

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