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:
Is there anything wrong with my code?
Last edited by vgersh99; 05-15-2019 at 11:52 AM..
Reason: Code tags, please!
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).
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?
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.
I have a factor program that runs and outputs to stdout all the prime numbers that are specified in the given paramters, in this case 30000000-31000000.
Command:
factor/factor 30000000-31000000
Sample output:
30999979 = 30999979
30999980 = 2^2 5 11 140909
30999981 = 3 10333327... (6 Replies)
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... (3 Replies)
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 ... (0 Replies)
Hi, This is my first post.
I have a korn shell script which outputs a select statment to a file. There is only one column and one row which contains a record count of the select statement.
The select statement looks something like this:
SELECT COUNT(some_field) AS "count_value"
... (2 Replies)
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:... (4 Replies)
Hi Guru's,
I am trying to grep a range of line numbers (based on match) and then look for another match which starts with a special character '$' and print the line number. I have the below code but it is actually printing the line number counting starting from the first line of the range i am... (15 Replies)
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... (5 Replies)
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. (4 Replies)
Hi all,
I am trying to zgrep / grep list of files so that it displays only the matching filename:line number and does not display the whole line, like:
(echo "1.txt";echo "2.txt") | xargs zgrep -no STRING
If I use -o option, it displays the matching STRING and if not used, displays the... (3 Replies)