gawk - Replacing two strings using awk -


i want replace @@ ^ , ¤¤ newline in file. wrote code below, feels there more elegant solution calling gawk twice. can tell me if there one?

cat test.txt | gawk '{ gsub("@@", "^"); print }' | gawk '{ gsub("¤¤", "\r\n"); print }' 

first, skin away cat. useless except file concatenation, purpose. awk command be

awk '{gsub("@@","^");gsub("¤¤","\r\n");print}' file 

if want remove line breaks before doing above

tr -d '\r\n' <file > temp && mv temp file 

Comments