How to print lines in csv file if 1 csv column field = "text". There are 10 column (;) in csv file
How to print lines in csv file if 1 csv column field = "xxxxx".
xxxxx = alphabet xxxxx = numeric There are 10 column in csv file: For instant : Test result;unix timestamp;1234567890;2233;111;A;B;C;D;E If csv column 5= 111, then print the line in source file |
And have you made any effort to solve this yourself ?.
|
Welcome to LQ!
How about some actual data and not some arbitrary 'examples"? |
i would look into the awk command.
|
Quote:
• awk • field separator Example: Code:
echo "Test result;unix timestamp;1234567890;2233;111;A;B;C;D;E HMW |
Another vote for awk. If you are thinking in columns, you should often be thinking awk :)
|
This posting has been cancelled due to click post button unintentionally
|
Quote:
Anyway, I just applied the grep CLI and manage to print the lines with specific column [2233]. Example source file: Test result;unix timestamp;1234567890;2233;111;A;B;C;D;E Test result;unix timestamp;1234567890;2235;111;A;B;C;D;E grep 2233 [source filename] > output file >Test result;unix timestamp;1234567890;2233;111;A;B;C;D;E |
No, you printed lines that had that number anywhere in the entire record. You could do it with grep, but you'll need some regex to eliminate the unwanted columns.
|
Using a mod of your example shows what syg00 is saying:
Code:
$ cat source.file |
All times are GMT -5. The time now is 09:21 PM. |