How to merge every two lines into one from the command line?
I have a text file with the following format. The first line is the “KEY” and the second line is the “VALUE”. KEY … Read more
I have a text file with the following format. The first line is the “KEY” and the second line is the “VALUE”. KEY … Read more
I have a script file which I need to modify with another script to insert a text at the 8th line. String to … Read more
I want to print the second-to-last column or field in awk. The number of fields is the NF variable. I know that I … Read more
I want the variable sum/NR to be printed side-by-side in each iteration. How do we avoid awk from printing newline in each iteration … Read more
My command’s output is something like: 1540 “A B” 6 “C” 119 “D” The first column is always a number, followed by a … Read more
Let’s say that during your workday you repeatedly encounter the following form of columnized output from some command in bash (in my case … Read more
I have a file which contains several thousand numbers, each on it’s own line: 34 42 11 6 2 99 … I’m looking … Read more
How to split the string when it contains pipe symbols | in it. I want to split them to be in array. I … Read more
I have a file which contain following lines: /logs/tc0001/tomcat/tomcat7.1/conf/catalina.properties:app.env.server.name = demo.example.com /logs/tc0001/tomcat/tomcat7.2/conf/catalina.properties:app.env.server.name = quest.example.com /logs/tc0001/tomcat/tomcat7.5/conf/catalina.properties:app.env.server.name = www.example.com In above output I want to … 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