Delete all lines beginning with a # from a file
All of the lines with comments in a file begin with #. How can I delete all of the lines (and only those … Read more
All of the lines with comments in a file begin with #. How can I delete all of the lines (and only those … Read more
Is there any bash command that will let you get the nth line of STDOUT? That is to say, something that would take … Read more
The following command is correctly changing the contents of 2 files. sed -i ‘s/abc/xyz/g’ xaa1 xab1 But what I need to do is … Read more
grep -A1 ‘blah’ logfile Thanks to this command for every line that has ‘blah’ in it, I get the output of the line … Read more
I need to retrieve last 100 lines of logs from the log file. I tried the sed command sed -n -e ‘100,$p’ logfilename … Read more
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, … Read more
So far I’ve been able to find out how to add a line at the beginning of a file but that’s not exactly … Read more
I would like to update a large number of C++ source files with an extra include directive before any existing #includes. For this … Read more
If I run these commands from a script: #my.sh PWD=bla sed ‘s/xxx/’$PWD”https://stackoverflow.com/” … $ ./my.sh xxx bla it is fine. But, if I … Read more
Being forced to use CVS for a current client and the address changed for the remote repo. The only way I can find … Read more