By George El. • January 2019 •
Reading time: 3 minutes
there is nothing more annoying than seeing unordered files, and this happens a lot when you have numbers in front of files like 1.file, 2.file etc. the command is
ls -1 | sed -r -e 's/([a-zA-z]+)([0-9]+)(\.txt)/\0 \2 \1 \3/' | xargs -n4 printf "%s %02d%s%s\n" | xargs -n2 mv and we will break it down
Using Linux Sed Command
By George El. • November 2018 •
Reading time: 2 minutes
In this post I provide examples of using the sed command
$ cat test1.txt | sed -r '' 1 text1 2 text2 3 text3 4 text4 5 text5 6 text6 7 text7 8 text8 9 text9 10 text10 $ cat test1.txt | sed -r '2,4d' 1 text1 5 text5 6 text6 7 text7 8 text8 9 text9 10 text10 $ cat test1.
Using Sed
By George El. • October 2018 •
Reading time: 5 minutes
sed is a very useful utility and certainly a whole book can be written for sed, Here are some basic examples
$ ls -1 file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt file9.txt delete last line
$ ls -1 | sed '$d' file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt delete first line