Sponsored Content
Top Forums Shell Programming and Scripting hiding output from find command Post 302157894 by JamesByars on Sunday 13th of January 2008 01:34:14 PM
Old 01-13-2008
Quote:
Originally Posted by redhead
If you use SH, then you can direct stderr, which is what is causing your "cannot open.." messages, to /dev/null and suppress it that way ie:
Code:
find / -name 'searchterm'   2> /dev/null

that is one way to do it. Thanks.

But just out of curiosity, why does the grep -v not find not work?

if we do

Code:
ls -ltr | grep -v find

then all the files containing find will not be shown.

If we do

Code:
find / -name 'filename' | grep -v find

then I would expect all lines returned with "find" on them being filtered out.

Why does this not happen?

Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

output of find command

Hi, I am confused about the output of find command. Please see the two find commands below. When i put "*.c" i get lots of files. But when i put *c only i get only one file. Any answer?? $ find . -name "*c" ./clarify/cheval/hp_server/rulemanager/rulemansvc... (3 Replies)
Discussion started by: shriashishpatil
3 Replies

2. Shell Programming and Scripting

Incorrect output using find command

I'm using the below command to list files older than 2 hours but it returns redundant output, am I missing something. # find . -mmin +120 -exec ls -l {} \; total 0 -rw-r--r-- 1 root system 0 Oct 13 09:52 test1 -rw-r--r-- 1 root system 0 Oct 13 09:52 test2 -rw-r--r-- 1 root ... (5 Replies)
Discussion started by: mbak
5 Replies

3. UNIX for Dummies Questions & Answers

problem with output of find command being input to basename command...

Hi, I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script. I am planning to do like this: if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies

4. Shell Programming and Scripting

Wrong output in find command

Hi guys - I am trying a small script to tell me if there is a file that exists less than 1k. It should report ERROR, otherwise the check is good. I wrote this script down, however it never runs in the if/then statement. It always returns the echo ERROR. MYSIZE=$(find /home/student/dir1... (8 Replies)
Discussion started by: DallasT
8 Replies

5. AIX

find command modify the output

Hello All, I am new to this shell scripting , I wanted to modify the output of my find command such that it does not display the path but only file names , for example I am searching for the files which are modified in the last 24 hours which is find /usr/monitor/text/ -type f -mtime... (3 Replies)
Discussion started by: raokl
3 Replies

6. Shell Programming and Scripting

Output of find command to variable?

Hi, I'd like to assign the output of the find command to a variable. What I need is to run the find command, and if it returns zero files, the program exits. so i'm trying to assign the output of the find command to the $var1 variable....and then if this is less than one, I echo a... (2 Replies)
Discussion started by: horhif
2 Replies

7. Shell Programming and Scripting

Compare the output of find command

Hi All, I am trying to run find command in a script to list out certain files based on a patter. However, when there is no file in the output, the script should exit. Tried a couple of operators (-n, -z) etc but the script does not work. I am confused whether a null string is returned... (3 Replies)
Discussion started by: danish0909
3 Replies

8. Programming

Hiding commnd line arguments in ps command on Linux

Hi Unix lovers, I am trying to seek an explanation for a simple looking code - why it works? I found below program which hide command line argument in ps command. #include <string.h> int main(int argc, char **argv) { // process command line arguments.... // hide command... (4 Replies)
Discussion started by: shriashishpatil
4 Replies

9. Shell Programming and Scripting

Better Align--output of find command

Hi, i have sh program which search for a file in a folder structure and provides its path. This is just used to see if that file exits more that once anywhere down the folder structure. I have used find command to search & printing it output on terminal. I have attached screen shot of it.... (10 Replies)
Discussion started by: praveenkumar198
10 Replies

10. UNIX for Beginners Questions & Answers

Find Memory and activity from command output

Hello - I have a requirement to get the Memory(Xmx) and the activity name using it. Sample input info : 1502 02:57 /bin/sh /opt/rather/bar/deploy/bar_run.sh 1545 02:57 java -Drather.repository=/opt/rather/bar/deploy/JobSyng_Barol_Count/JobSyng_Barol_Count/../lib -Xms1024M... (3 Replies)
Discussion started by: Varja
3 Replies
OPENVT(1)							     Linux 1.x								 OPENVT(1)

NAME
openvt - start a program on a new virtual terminal (VT). SYNOPSIS
openvt [-c vtnumber] [-s] [-u] [-l] [-v] [--] command command_options DESCRIPTION
openvt will find the first available VT, and run on it the given command with the given command options, standard input, output and error are directed to that terminal. The current search path ($PATH) is used to find the requested command. If no command is specified then the environment variable $SHELL is used. OPTIONS -c vtnumber Use the given VT number and not the first available. Note you must have write access to the supplied VT for this to work. -e Directly execute the given command, without forking. This option is meant for use in /etc/inittab. -s Switch to the new VT when starting the command. The VT of the new command will be made the new current VT. -u Figure out the owner of the current VT, and run login as that user. Suitable to be called by init. Shouldn't be used with -c or -l. -l Make the command a login shell. A - is prepended to the name of the command to be executed. -v Be a bit more verbose. -w wait for command to complete. If -w and -s are used together then openvt will switch back to the controlling terminal when the com- mand completes. -- end of options to openvt. NOTE
If openvt is compiled with a POSIX (GNU) getopt() and you wish to set options to the command to be run, then you must supply the end of options -- flag before the command. EXAMPLES
openvt can be used to start a shell on the next free VT, by using the command: openvt bash To start the shell as a login shell, use: openvt -l bash To get a long listing you must supply the -- separator: openvt -- ls -l HISTORY
Earlier, openvt was called open. It was written by Jon Tombs <jon@gtex02.us.es or jon@robots.ox.ac.uk>. The -w idea is from "sam". SEE ALSO
chvt(1), doshell(8), login(1) 19 Jul 1996 V1.4 OPENVT(1)
All times are GMT -4. The time now is 11:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy