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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cut last character of string

Status
Not open for further replies.

malladisk

Programmer
Jun 14, 2001
69
US
Hi, I need to cut the last character of a string in a shell script.
For example, I do an
$ls *.c
and from the output produced, I need to cut out the last character. Obviously, the string sizes would be different so I can't use "cut".
How can this be done?
Thanks,
Sashi
 
Something like this ?
ls *.c | sed 's!.$!!'

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

Part and Inventory Search

Sponsor

Back
Top