Tag Info

New answers tagged


You can use column: $ column -t < file menuNAME menuNAME2 menuNAME3 word word2 THISwordisLongest THISwordisLongest word wordLONG wordLONG THISwordisLongest word


paste is probably your best bet. You can extract the relevant bits with cut, grep and awk like this: (awk 'NR==1' RS= infile | cut -d: -f1; cut -sd: -f2 infile) If the 5th column should be eliminated, append awk 'NR%5' like this: (awk 'NR==1' RS= infile | cut -d: -f1; cut -sd: -f2 infile) | awk 'NR%5' Now columnate with paste: (awk 'NR==1' RS= infile ...


sed -i '/Baboon/ s/$/\t5/' your_file This will search your_file for the lines containing Baboon and replace the last character on those lines with a tab character followed by a 5. The -i will write the changes to the file in-place.


If the file is named baboon.txt: sed '/Baboon/ s/$/ Baboon/' baboon.txt To write the changes to file use the -i option. sed -i '/Baboon/ s/$/ Baboon/' baboon.txt


Should be quite simple: awk '$1==$2{$2=""}1' file First we test if first column is equal second ($1==$2) and if result is positive then delete second column ($2=""). Final 1 just prints everything.

Top 50 recent answers are included