suppress some grep outputs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting suppress some grep outputs
# 1  
Old 05-09-2012
suppress some grep outputs

Hello Friends,

Im working on Ksh (it is not my will Smilie )
I would like to get rid off the outputs lines which includes "can't open" .. i guess it must be an easy thing but could not find any usefull thing,

Code:
ls -l *credit* | xargs grep -i "*data*"

Code:
22:set conv(DATA)    B16
22:proc insert_task_msisdn {msisdn command {adc_data ""}}
grep: can't open -rwxr-xr-x
grep: can't open sas
grep: can't open sas
grep: can't open 763


Code:
Output:

22:set conv(DATA)    B16
22:proc insert_task_msisdn {msisdn command {adc_data ""}}

Best Regards,
# 2  
Old 05-09-2012
error redirection

have you looked into the 2> option? this redirects errors.
Code:
ls | grep .txt 2>/dev/null

# 3  
Old 05-09-2012
How about:
Code:
ls -l *credit* | xargs grep -i "*data*" | grep -v "can't open"

# 4  
Old 05-09-2012
Thanks Joeyg, redirecting error output didnt come into my mind
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Loop grep, outputs in files

Hi, I try to create a simply code but I have problems... Ubuntum, Bash version: 4.3.46 Bash INPUT file (csv): TS133_29BC,xx2274305 TS133_29BC,rps4576240 av137_37BC,wfs2274305 av137_37BC,ftrs4576240 T1S138_30BC,rfss2255526 T1S138_30BC,rgas2274305 OUTPUT files (csv): File TS133_29BC... (6 Replies)
Discussion started by: echo manolis
6 Replies

2. UNIX for Dummies Questions & Answers

[Solved] Suppress do you wish to overwrite (y or n)?

Hi all, as i have to deal every day with .log and also .csv files, i would like to know if there is any way to suppress "do you wish to overwrite (y or n)?" prompt with the option no for all prompts, the command i usually run is the following, find... (2 Replies)
Discussion started by: charli1
2 Replies

3. Shell Programming and Scripting

How to suppress error in following command?

I have a file containing data in multiple columns. The colums are seperated by pipe (|). I need to extract information as below: myfile_20130929_781;10;100.00 where myfile.txt is the file name. 10 is the number of records in the file starting with 120 and 100.00 is the sum of 26th field of... (16 Replies)
Discussion started by: angshuman
16 Replies

4. Shell Programming and Scripting

Suppress Error Message

How can I suppress a error message being given by awk command in bash shell? (2 Replies)
Discussion started by: Prachi Gupta
2 Replies

5. Shell Programming and Scripting

create outputs from other command outputs

hi friends, The code: i=1 while do filename=`/usr/bin/ls -l| awk '{ print $9}'` echo $filename>>summary.csv #Gives the name of the file stored at column 9 count=`wc -l $filename | awk '{print $1}'` echo $count>>summary.csv #Gives just the count of lines of file "filename" i=`expr... (1 Reply)
Discussion started by: rajsharma
1 Replies

6. Shell Programming and Scripting

Suppress the output of ping

Hi All, I just wanted to know, is there a way to suppress the output of the following i.e. the output should not be written on the screen: ping 10.1.23.234 -n 1 PING 10.1.23.234: 64 byte packets 64 bytes from 10.1.23.234: icmp_seq=0. time=0. ms ----10.1.23.234 PING Statistics---- 1... (2 Replies)
Discussion started by: ss_ss
2 Replies

7. Shell Programming and Scripting

how to suppress dd output?

I have to stop the output of dd from writing to terminal. Here is the command: sudo dd if=boot1h of="/dev/r$temp1" Here is the output: 2+0 records in 2+0 records out 1024 bytes transferred in 0.000804 secs (1273715 bytes/sec) I have tried >> log.txt but it doesn't work. Is there... (4 Replies)
Discussion started by: msf5042
4 Replies

8. Shell Programming and Scripting

suppress the Connection text

Hi Guys, I am calling a function from my script. The function has to return only one value which is the year. But in the function, i am having connecting statement to the database. The connection information is coming along with the year variable. I want to suppress the connecting... (1 Reply)
Discussion started by: mac4rfree
1 Replies

9. Shell Programming and Scripting

suppress unzip queries

hey i have piece of code working in solaris and same code i want to deploy it in linux but in solaris its not asking for queris but in linux it is !!!! COMMAND ==> unzip $test/alter.war -d $webclientHome/. OUTPUT==> In solaris it proceeds with following traces replace /aa/test.txt?... (4 Replies)
Discussion started by: crackthehit007
4 Replies
Login or Register to Ask a Question