I have a text file separated by space as follows. I need to re-arrange the columns so that the first column is at the end of each line.
I have an idea of how this could be done using cut -d' ' f1
but I'm wondering if there is an easy way with awk
or sed
.
Text File:
™️ trade mark
ℹ️ information
↔️..↙️ left-right arrow..down-left arrow
↩️..↪️ right arrow curving left..left arrow curving right
⌚..⌛ watch..hourglass done
⌨️ keyboard
⏏️ eject button
⏩..⏳ fast-forward button..hourglass not done
⏸️..⏺️ pause button..record button
Ⓜ️ circled M
▪️..▫️ black small square..white small square
▶️ play button
◀️ reverse button
Want symbol list to follow description instead.
Best Answer
Use
sed
This
\([^ ]*\)
will match everything until a non-space characters seen.The parentheses
\(...\)
is used to made a group matching which its index would be\1
.The
\(.*\)
matches everything after first group and it's indexed\2
.The
*
in\(...\) *\(...\)
out of matched groups will ignore to print in output which is matching spaces between group 1 and 2, you could use\s*
(with GNUsed
) or[[:space:]]*
(standardly) instead to match any spacing characters instead of just ASCII SPC as well.Then at the end first we are printing matched group2 than group1 with a space between.