Skip to main content
Fixed format
Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

SIMPLEST SOLUTION

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv

1. Please note that ',' defines your separator to be comma.

2. $ defines column. so, $7 defines the column number which you want to have a special value. here 7.

3. ~ /-99/ searches for -99. you might put anything you need.

4. $0 stands for ALL the columns in the file. You could simply write $1","$2","...... if you do not want to print only specific columns.(or $1$2... if you do not need comma as separator for your results)

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv

5. > result.csv saves the output instead of printing it in terminal in result.scv file.

  1. Please note that ',' defines your separator to be comma.

  2. $ defines column. so, $7 defines the column number which you want to have a special value. here 7.

  3. ~ /-99/ searches for -99. you might put anything you need.

  4. $0 stands for ALL the columns in the file. You could simply write $1","$2","...... if you do not want to print only specific columns.(or $1$2... if you do not need comma as separator for your results)

  5. > result.csv saves the output instead of printing it in terminal in result.scv file.

SIMPLEST SOLUTION

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv

1. Please note that ',' defines your separator to be comma.

2. $ defines column. so, $7 defines the column number which you want to have a special value. here 7.

3. ~ /-99/ searches for -99. you might put anything you need.

4. $0 stands for ALL the columns in the file. You could simply write $1","$2","...... if you do not want to print only specific columns.(or $1$2... if you do not need comma as separator for your results)

5. > result.csv saves the output instead of printing it in terminal in result.scv file.

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv
  1. Please note that ',' defines your separator to be comma.

  2. $ defines column. so, $7 defines the column number which you want to have a special value. here 7.

  3. ~ /-99/ searches for -99. you might put anything you need.

  4. $0 stands for ALL the columns in the file. You could simply write $1","$2","...... if you do not want to print only specific columns.(or $1$2... if you do not need comma as separator for your results)

  5. > result.csv saves the output instead of printing it in terminal in result.scv file.

SIMPLEST SOLUTION

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csvawk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv

1. Please note that ','',' defines your separator to be comma.   

2. $ :$ defines column. so, $7$7 defines the column number which you want to have a special value. here 77.   

3. ~ /-99/ : ~ /-99/ searches for -99-99. you might put anything you need.   

4. $0 :$0 stands for ALL the columns in the file. You could simply write $1","$2","...... if$1","$2","...... if you do not want to print only specific columns.(or $1$2...$1$2... if you do not need comma as separator for your results)   

5. > result.csv : > result.csv saves the output instead of printing it in terminal in result.scvresult.scv file.

GOOD LUCK

SIMPLEST SOLUTION

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv

1. Please note that ',' defines your separator to be comma.  2. $ : defines column. so, $7 defines the column number which you want to have a special value. here 7.  3. ~ /-99/ : searches for -99. you might put anything you need.  4. $0 : stands for ALL the columns in the file. You could simply write $1","$2","...... if you do not want to print only specific columns.(or $1$2... if you do not need comma as separator for your results)  5. > result.csv : saves the output instead of printing it in terminal in result.scv file.

GOOD LUCK

SIMPLEST SOLUTION

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv

1. Please note that ',' defines your separator to be comma. 

2. $ defines column. so, $7 defines the column number which you want to have a special value. here 7. 

3. ~ /-99/ searches for -99. you might put anything you need. 

4. $0 stands for ALL the columns in the file. You could simply write $1","$2","...... if you do not want to print only specific columns.(or $1$2... if you do not need comma as separator for your results) 

5. > result.csv saves the output instead of printing it in terminal in result.scv file.

Source Link
Tara
  • 21
  • 1

SIMPLEST SOLUTION

awk -F',' '$7 ~ /-99/ {print $0}' filename.csv > result.csv

1. Please note that ',' defines your separator to be comma. 2. $ : defines column. so, $7 defines the column number which you want to have a special value. here 7. 3. ~ /-99/ : searches for -99. you might put anything you need. 4. $0 : stands for ALL the columns in the file. You could simply write $1","$2","...... if you do not want to print only specific columns.(or $1$2... if you do not need comma as separator for your results) 5. > result.csv : saves the output instead of printing it in terminal in result.scv file.

GOOD LUCK