perl - Regular expression to replace a word with another word on the different line unix -
let a,b,c,d,e,f words
input file
a "\t" b c "\t" d e "\t" f
etc...
output file:
b "\t" c d "\t" e f "\t" etc...
replace word word b 1 same line , replace word b word c next line. wise other lines.
any sed/awk/perl oneliner accomplish that?
one way awk
without regex:
awk ' begin { fs=ofs="\t" } nr==1 { last=$nf; next } { last=last fs $1; print last; last=$nf} end { print $nf }' file
Comments
Post a Comment