Reputation: 579
Hi folks trying a very simple awk script to parse a simple CSV. The script runs, however I am getting only one result instead of two.
CSV file:
Test4|Test5|Test6
Test1|Test2|Test3
Script:
#!/bin/bash
awk -F "|" 'NR > 0 {print $2}' UserAgents.csv
Actual Output:
Test5
Expected Output:
Test5
Test2
Upvotes: 1
Views: 122
Reputation: 1
It looks like you are on a Mac, with CR
line endings, this can be workaround:
awk '{print $2}' FS='|' RS='\r'
Result:
Test5
Test2
Upvotes: 3