How to split single column string into two columns
Hi, I'm new to Linux, after I grep "Size" and "Price" from another file, I have a single column string with following format:
Size: S Size: M Size: L Size: XL Price: 1 Price: 2 Price: 3 Price: 4 ... I want to split it into two columns with the following format Size: S Price: 1 Size: M Price: 2 Size: L Price: 3 Size: XL Price: 4 May I know how to accomplish this, is sed a possible solution? thanks! |
Hi,
here is an awk solution: Code:
awk '/Size/ {a[i++]=$0};/Price/ {print a[NR-i-1]" "$0}' file |
Quote:
|
All times are GMT -5. The time now is 03:42 AM. |