How to remove first/last character from a string using SED How to remove first/last character from a string using SED, Removing the last three characters from every filename, Removing first character from each filename/string, Removing last character from each filename/string
Other articles in Server Operating Systems / Administration Guides » How to cut out first last n characters from each file name, from a filelist » Substitute strings in files with perl, sed or vi(m) » How to cat a file removing commented lines in Unix/Linux » Shell scripting - conditions for IF conditional function » How to rename files/directories to uppercase/lowercase character names
Contact webmaster regarding this article Register or Login to post your article
12 comment(s) to How to remove first/last character from a string using SED:
1. Re: How to remove first/last character from a string using SED
Oracle Database Administrator by malik shahid
at February 10th, 2010 - 15:06 It is very helpful. but can you please explain the regular expression working logic
2. Re: How to remove first/last character from a string using SED
gopher by JohnC
at February 08th, 2010 - 11:44 Thanks very much .. saved a lot of time, not everybody is an expert in awk,sed etc!
3. Re: How to remove first/last character from a string using SED
Remove the character before the last character wi by Andrei
at November 04th, 2009 - 16:50 Remove the character before the last character with SED http://forum.ivorde.ro/remove-the-character-before-the-last-character-with-sed-shell-scripting-t40.html
4. Re: How to remove first/last character from a string using SED
qus.. by srutho
at November 04th, 2009 - 12:59 hw to delete the character before the last character in each line of a file????
5. Re: How to remove first/last character from a string using SED
sed by swap
at September 14th, 2009 - 12:03 how to remove last but one character in a line using sed
6. Re: How to remove first/last character from a string using SED
Mr. by Tinku
at September 13th, 2009 - 17:02 Question1:-How to remove/delete last but one character in everyline in a file using sed command. question2:-How to remove first character in everyline in a file using sed command. Questions3:-How to swap 3rd,4th words in a file using sed command
7. Re: How to remove first/last character from a string using SED
nice article by ujjwal b soni
at December 24th, 2008 - 11:43 Hi,
Its really a nice article !!!
Cheers,
Ujjwal B Soni
baroda, gujarat, india
8. Re: How to remove first/last character from a string using SED
@sekhar by admin
at November 04th, 2008 - 16:12 Check out this article: http://www.ivorde.ro/How_to_cut_out_first_last_n_characters_from_file_name-100.html It shows how to remove the first three lines from each file's name. It can easily be adapted to other tasks, if you need to.
9. Re: How to remove first/last character from a string using SED
how to apply the Command for Directory Files by sekhar
at October 17th, 2008 - 13:45 hii dude, of Course u'r scripts looks correct ,but i dont want to take input from the text files ,Instead of that my directory has so many files , and i need to cut the First three Characters from the Filenames.And the Operation should b Inplace(means the Next time i open the Directory it Should Contains the modified files ...
Thankq
10. Re: How to remove first/last character from a string using SED
cat "folder" ? by Nico
at September 18th, 2008 - 21:40 I get a whole lot of "No such file or directory" if I try to do this in a folder. I'm assuming you were doing this on a text file. What if you wanted to batch rename a whole bunch of files, taking out the first n characters?
11. Re: How to remove first/last character from a string using SED
To Aerouge by Andrei
at June 19th, 2008 - 17:33 You can use the above example also to remove first/last two/three and so on characters from a string. Just use dot(.) characters as more as the number of characters you want to remove or replace. URW
12. Re: How to remove first/last character from a string using SED
Great Tut... Kudos by Aerouge
at June 17th, 2008 - 17:48 You have no idea how hard it is to find an article on this topic... and once I found your´s I could stop searching! Great work, percise, good examples and really helpfull!
Thanks a thousand times!
|