Grep Input Output Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and linux input/output error policies of this site About Us Learn more about Stack Overflow the grep: memory exhausted company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Grep Exclude Directory
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes
Man Grep
a minute: Sign up Grep: /proc/sysrq-trigger: Input/output error up vote 4 down vote favorite 5 I am searching a file system and utilising grep. I see that everything is working until this error appears: Grep: /proc/sysrq-trigger: Input/output error I have found information in various places on the net where others have come accross the same problem, but nowhere really was there grep recursive anything that worked. I tried 2>/dev/null which supressed the error but didn't 'skip the file' which is really what I hoped it would do. Instead it just stops the process (which is a find/sed process utilising grep). I think there is a way to specify files for exclusion using grep, but I am hoping that there may be a more robust and elegant solution. linux grep share|improve this question asked Feb 26 '12 at 9:50 user1166981 54741530 So use find $whatever ! -wholename "/proc/sysrq-trigger"? –jørgensen Feb 26 '12 at 11:21 Why are you reading files recursively in /proc at all? We might be able to help you more if you told us what you are trying to do in broader terms. –thkala Feb 26 '12 at 18:45 @thkala trying to search for files with a certain string in it then delete the entire contents of the file. –user1166981 Feb 29 '12 at 21:33 @user1166981: an interesting detail: you can't delete files in /proc! More important: you shouldn't mess with files in /proc –thkala
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers
Linux Grep
or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question _ Unix grep command & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only grep command in unix takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How to search text throughout entire file system? up vote 32 down vote http://stackoverflow.com/questions/9452104/grep-proc-sysrq-trigger-input-output-error favorite 9 Assuming that the grep tool should be used, I'd like to search for the text string "800x600" throughout the entire file system. I tried: grep -r 800x600 / but it doesn't work. What I believe my command should do is grep recursively through all files/folders under root for the text "800x600" and list the search results. What am I doing wrong? grep recursive share|improve this question edited Jul 6 '11 at 12:22 Gilles 372k696751126 asked Jul 6 '11 at 7:32 Level1Coder http://unix.stackexchange.com/questions/16138/how-to-search-text-throughout-entire-file-system 3682713 2 And by "it doesn't work" you mean exactly what? Does it not print any output, hangs or print lots of Permission denied errors? Did you run it as root or a normal user? –alex Jul 6 '11 at 7:42 I'm getting some traction, first of all I was in my user home directory trying to run the command. So now I've cd / out to root. Next I tried the same command as above and I'm getting a lot of Permission denied errors. Ok, so now I try sudo grep -r 800x600 / and then I get a /proc/sysrq-trigger: Input/output error –Level1Coder Jul 6 '11 at 8:00 Hmm, don't know why it wouldn't work. You may ignore access errors by doing grep -r 800x600 / 2>/dev/null. You can also try running it as root. –Totor Jan 26 '14 at 1:28 add a comment| 4 Answers 4 active oldest votes up vote 44 down vote accepted I normally use this style of command to run grep over a number of files: find / -xdev -type f -print0 | xargs -0 grep -H "800x600" What this actually does is make a list of every file on the system, and then for each file, execute grep with the given arguments and the name of each file. The -xdev argument tells find that it must ignore other filesystems - this is good for avoiding special filesystems such as /proc. However it will
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers http://unix.stackexchange.com/questions/3514/how-to-grep-standard-error-stream-stderr or posting ads with us Unix & Linux Questions Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only http://serverfault.com/questions/514093/how-to-search-the-entire-system-linux-for-a-particular-string takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How to grep standard error stream (stderr)? up vote 48 down vote favorite output error 16 I am using ffmpeg to get the meta info of an audio clip. But I am unable to grep it. $ ffmpeg -i 01-Daemon.mp3 |grep -i Duration FFmpeg version SVN-r15261, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=i386 --extra-cflags=-O2 ... I checked, this ffmpeg output is directed to stderr. $ ffmpeg -i 01-Daemon.mp3 2> /dev/null So I think that grep is unable to read error stream to catch matching lines. How can we enable grep input output grep to read error stream? Using nixCraft link, I redirected standard error stream to standard output stream, then grep worked. $ ffmpeg -i 01-Daemon.mp3 2>&1 | grep -i Duration Duration: 01:15:12.33, start: 0.000000, bitrate: 64 kb/s But what if we do not want to redirect stderr to stdout? grep io-redirection ffmpeg share|improve this question edited Oct 31 '10 at 5:25 Stefan 8,4551966111 asked Oct 26 '10 at 1:42 Andrew-Dufresne 1,13831318 1 I believe that grep can only operate on stdout (Although I can't find the canonical source to back that up), which means that any stream needs to be converted to stdout first. –Stefan Lasiewski Oct 26 '10 at 18:20 6 @Stefan: grep can only operate on stdin. It's the pipe created by the shell that connects grep's stdin to the other command's stdout. And the shell can only connect an stdout to an stdin. –Gilles Oct 26 '10 at 19:16 Whoops, you're right. I think that's what I really meant to say , I just didn't think it through. Thanks @Giles. –Stefan Lasiewski Oct 27 '10 at 17:37 Do you want it to still print stdout? –Mikel Feb 8 '11 at 2:06 add a comment| 7 Answers 7 active oldest votes up vote 36 down vote None of the usual shells (even zsh) permits pipes other than from stdout to stdin. But all Bourne-style shells support file descriptor reassignment (as in 1>&2). So you can temporarily diver
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How to search the entire system (Linux) for a particular string? up vote 4 down vote favorite I need to find this string: 7z a -p I've tried: grep -iR "7z a -p" / But it seems to hang after a while, with lots of: grep: /sys/class/vc/vcs5/power/autosuspend_delay_ms: Input/output error grep: warning: /sys/class/vc/vcsa5/subsystem: recursive directory loop grep: /sys/class/vc/vcsa5/power/autosuspend_delay_ms: Input/output error grep: warning: /sys/class/vc/vcs6/subsystem: recursive directory loop EDIT - However, this seems to just look at static text files. In addition, what about runtime areas, memory and processes? ie the entire system? eg for mysql: ps aux | grep "mysql -u user -p" shows : 38164 4292 pts/0 S+ 13:16 0:00 mysql -uodbcuser -px xxxxxxxx Interestingly ps aux does hide the password with xxxxx. I can try with 7zip but it's quite fast, it has to be running at the same time as you run the ps aux command to "catch it. linux bash share|improve this question edited Jun 10 '13 at 12:21 asked Jun 7 '13 at 12:28 user127379 178110 What are you trying to do? –Michael Hampton♦ Jun 10 '13 at 10:22 Trying to guarantee that the "7z a -p$password" is not stored on the server. Hence I need to demonstrate some tests that show this. –user127379 Jun 10 '13 at 12:14 add a comment| 3 Answers 3 active oldest votes up vote 8 down vote You should exclude directories like /sys/, /proc/ and /dev/ from your command: grep -iR --exclude-dir='/sys' --exclude-dir='/proc' --exclude-dir='/dev' "7z a -p" / share|improve this answer answered Jun 7 '13 at 12:38 etagenklo 4,25411326 Thanks, what about runtime processes/memory? –user127379 Jun 10 '13 at 12:24 add a comment| up vote 1 down vote Presumably,