Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is an PLUTO
- This is PINEAPPLE
- This is ORANGE
- This is RICE
- PLUTO:
- This is an PLUTO
- PINEAPPLE:
- This is an PINEAPPLE
- ORANGE:
- This is an ORANGE
- RICE:
- This is an RICE
- $ awk '{ print $NF ":"; print }' file
- PLUTO:
- This is an PLUTO
- PINEAPPLE:
- This is PINEAPPLE
- ORANGE:
- This is ORANGE
- RICE:
- This is RICE
- awk '{ print $NF ":" ORS $0 }' file
- awk '{ printf("%s:n%sn", $NF, $0) }' file
- $ sed 'h; s/.* //; s/$/:/; G' file
- PLUTO:
- This is an PLUTO
- PINEAPPLE:
- This is PINEAPPLE
- ORANGE:
- This is ORANGE
- RICE:
- This is RICE
- h; # Put the pattern space (the current line) into tho hold space (general purpose buffer)
- s/.* //; # Remove everything up to the last space character in the pattern space
- s/$/:/; # Add colon at the end
- G; # Append the hold space (original line) with an embedded newline character
- # (implicit print)
- awk '{$0=$NF":n"$0}1' file
Add Comment
Please, Sign In to add comment