Let's say I have text file like:  R1 12 324 3453 36 457 4 7 8R2 34 2342 2525 25 25 26 26 2 2R3 23 2342 32 52 54 543 643 63R4 25 234 2342 4 234242I want to use awk to process these lines differently, likeawk '/R1/ { print => $0} /R2/ { print * $0} 'and I want to also print all the rest of the lines as they are (without making duplicates of the lines I've already processed), basically I need an  /ELSE/ { print $0} at the end of my awk line.Is there such a thing?
When using awk /pattern/ { print text} /patern/ {print } is there an ELSE pattern?
awk
Simplified Approach with awkawk '/R1/ {print => $0;next} /R2/{print * $0;next} 1' text.file[jaypal:~/Temp] cat text.file R1 12 324 3453 36 457 4 7 8R2 34 2342 2525 25 25 26 26 2 2R3 23 2342 32 52 54 543 643 63R4 25 234 2342 4 234242[jaypal:~/Temp] awk '/R1/ { print => $0;next} /R2/{print * $0;next}1' text.file=>R1 12 324 3453 36 457 4 7 8*R2 34 2342 2525 25 25 26 26 2 2R3 23 2342 32 52 54 543 643 63R4 25 234 2342 4 234242[jaypal:~/Temp] Breakout of Pattern {Action} Statements:/R1/ { print => $0;next} : This means lines having /R1/ the action of printing => will be done. next means the rest of the awk statements will be ignored and next line will be looked at. /R2/{print * $0;next} : This means lines matching the pattern /R2/ the action of printing * will be done. When awk processing starts, the first pattern {action} statement will be ignored as the pattern /R1/ will not be true for lines having /R2/. So second pattern {action} statement will done on the line. next would again mean that we don't want any more processing and awk will duly go to the next line. 1 prints all lines. When just a condition is supplied with no {action}, awk defaults to using {print}. Here the condition is 1 which is interpreted as true, so it always succeeds. If we get to this point, it's because the first and second pattern {action} statements were ignored or by-passed (for lines not containing /R1/ and /R2/), so the default print action will be done for the remaining lines.