Follow me
-
Recent Posts
calendar
December 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Recent Comments
- Stan on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- Cormac on Pandas : how to compare dataframe with None
- LP on AWK: the substr command to select a substring
- jrab on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- How to disable SSL verification for urlretrieve? – Peter's blog on python: certificate verified failed
Archives
Categories
Meta
Tag Archives: sed
sed: how to add text at the end of the file
Use the $a syntax and sed: sed -i ‘$a some text’ filenamesed -i ‘$a some text’ filename -i parameter means in place. To test without changing the original file, remove the -i option. The results will be print on the … Continue reading
SED: insert text at the top of a bunch of files
at a line at the top of a file Imagine, you have a set of files ending in .txt, and you want to add the statement #header at the top of each of them. Then, simply type: ls *.txt | … Continue reading
SED: replace a pattern in all files in one command
I have a bunch of c files and I want to change the first line that appears as //something into /*something Using sed, you can use the command ‘s/old_pattern/new_pattern/g’ where -e stands for edition, and -i to apply the changes. … Continue reading
Combine AWK and SED to create symbolic links
The unix tools AWK and SED are very powerful tools to manipulate files and perform text processing tasks. It’s true that the syntax is not always very intuitive but it can help you in performing task in a single line. … Continue reading
SED: how to add a line at the top of files
Imagine, you have a set of ReST files, and you want to add the statement “author: your name” at the top of each of them. First, identify the files you want to edit and pipe them to sed: ls *.rst … Continue reading