# echo "This is last character" | sed 's/.$//g'
This is last characte
Showing posts with label sed. Show all posts
Showing posts with label sed. Show all posts
Friday, November 6, 2009
How to delete the last character in a line?
This is simple and without any description, here is the regex.
Labels:
Regular expressions,
sed
Thursday, June 19, 2008
SED & TR uses
Here are the quickies for my very own sed and tr:
To replace "NEWLINE" (\n) with "comma" (,)
To find "tree" and replace with "plant" in a file (using sed):
To replace "NEWLINE" (\n) with "comma" (,)
cat filename | tr '\n' ','
To find "tree" and replace with "plant" in a file (using sed):
sed -i 's/tree/plant/g' filename
Labels:
Quick tips,
sed,
tr
Subscribe to:
Posts (Atom)