How to output non-number lines with grep?


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
How to output non-number lines with grep?

I want to check my data quality. I want to output the lines with non-number. I used the grep command:
grep '[^0-9,. ]' myfile.csv
Since my file is csv file, I don't want to output the lines with comma. And I also don't want to output "." or space. But I still get the lines like the following:
Code:
1,66.2,16.57,0, ,,,, ,,86,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,,,0,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,2,,,0,

Is there anything wrong with my code?

Last edited by vgersh99; 1 Week Ago at 10:52 AM.. Reason: Code tags, please!
# 2  
grep '[^0-9,. ]' twotwo.csv on a sample file, produces nothing. Which is correct.
Could you provide a larger sample file using code tags.
Also, provide the output of cat -vet mySampleCSV.csv (using code tags as well).
# 3  
Thank you for your reply. I uploaded my file. Can you see twotwo.txt. Since the forum cannot upload the csv file, I changed the extend name to txt. But it is actually a csv file. I used the same code on this file, but not work. It still output all of those three lines. Can you re-produce that?
# 4  
this is a case of Windows file have a traling '^M' (line-feed) - had you provided a cat -vet output as asked, you would have seen it as well.
Run dos2unix mySampleFile and re-run your grep.
This User Gave Thanks to vgersh99 For This Post:
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
awk to output lines less than number
cmccabe
I am trying to output all lines in a file where $7 is less than 30. The below code does create a result file, but with all lines in the original file. The original file is tab deliminated is that the problem? Thank you :). awk 'BEGIN{FS=OFS=","} $7 < 30 {print}' file.txt > result.txt...... Shell Programming and Scripting
3
Shell Programming and Scripting
How to print N number of lines before and after the grep?
Huvan
Hi , My record file , need to print up to above (DATA array)(there may be n no lines ) , grep "myvalue" row now .....suggest me some options --- DATA Array--- record type xxxxx sequence type yyyyy 2 3---> data1 /dev/ --- DEVICE --- MAXIMUM_People= data_blocks= MY_value=2 xyz abc ...... Shell Programming and Scripting
0
Shell Programming and Scripting
Grep lines for number greater than given number
meena_2013
Hello, I am newbie to bash scripting. Could someone help me with the following. I have log file with output as shown below **************************LOG************************* 11/20/2013 9:11:23.64 Pinging xx.xx.xx.xx with 32 bytes of data: 11/20/2013 9:11:23.64 Reply from xx.xx.xx.xx:...... Shell Programming and Scripting
4
Shell Programming and Scripting
how to grep a number from output line
nitin_aaa27
I`m having a output shown below, CFR 235,BBC DM-2 ALL CFR 111,BBC DM-2 ALL CFR 333,BBC DM-2 ALL from the above Output i want to use 235,111,333 as input for other purpose. these no always change every time i run script.so please suggest me the way i could do it with example,i have tried...... UNIX for Dummies Questions & Answers
5
UNIX for Dummies Questions & Answers
number of lines returned from a grep command
cesarNZ
hi all, from a shell (ksh) script, i am doing a 'grep'. how do i find out the number of lines returned from that 'grep' command ?? thanks in advance.... Shell Programming and Scripting
4
Shell Programming and Scripting