Perl or Unix Shell scripting to sieve out records with a certain value of a column

sunhux
sunhux used Ask the Experts™
on

I have a csv (comma separated value) text file exported out from Excel.
Original file has thousands of lines/records with columns/fields being
segregated by comma (,).

I'll need a Perl / Shell script that would sieve out lines/records that has
a certain value from column 4 & output those records/lines that do not
have this value in the 4th column.

So, take for example the attached text data file (only 3 lines/records in it):
./script "3"

would output the last 2 lines, filtering off the 1st line from being output.

Note that line 2 has a number "0.3" in its 4th column but it's not sieved
out because only those lines with the exact value of 3 in its 4th column
would be output (so 0.3, 33, 3.3 is not equal to 3, so those lines with
these values in its 4th column would not be sieved out
prmcsv.txt
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
awk -F , '$4!=3 {print}' prmcsv.txt
Distinguished Expert 2017
Commented:
You can modify the perl script I posted in the prior question:
http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_26291828.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial