I want to print the field number and field like this ... what is the best way to awk? if so, how? The fields in the input line may vary. Expected result: 1A2B3C4D
I am able to print the field , But there is a need to print field numbers. Here's what I have
echo "a | b | c | d" | Awk -F "|" '{For (i = 1; i & lt; = NF; i ++) print $ i}' abcd
You can use awk commands like:
echo "a | b | c | d" | Awk -F "|" '{I (i = 1; i & lt; = NF; i ++) print I, $ i}'
No comments:
Post a Comment