General :: Find Argument List Too Long?
May 12, 2011I want to search in many many files for a string.
I used find /archive/* -print0 | xargs -0 grep 'robert' -sl
Is there a simple method to do it ?
I want to search in many many files for a string.
I used find /archive/* -print0 | xargs -0 grep 'robert' -sl
Is there a simple method to do it ?
I've got a directory with thousands of files and I want to delete those that contain specific text.When I try:Code: ls | grep -l "specific text" * | xargs rm I get the error: Code: /bin/grep: Argument list too long Is there an easy way to get around this without having to move files into seperate folders and processing them in batches? I found an article on getting around this problem, but I'm kind of new to Linux and don't know how to apply this to my specific problem.
View 3 Replies View RelatedI have the standard problem of trying to count a large number of files in a directory (>100k)
I have tried: ls ~/user/images/* -l | wc -l and find ~/user/images/* -maxdepth 1 -type f | wc -l
In both cases, I get the argument list too long error message.
I have tried using xargs but I can't seem to get it to work right.
The command
returns a valid answer but it includes all the subdirectories in the file count.
I'm trying to do a
find /photos/* -type f -mtime +365
to find all my pictures that are over a year old, but I keep getting argument list too long. How can I view what all the results are, even if it just dumps it to a file that I have to open?
I need to delete all *.trc files that are older than 30 days and I am getting a "Argument list too long" error. There are other files that should not be deleted which is why I am using the "*.trc" and newer files need to be kept as well. I have seen other postings but they do not cover both of the conditions. Below are 2 of the many attempts at doing this but I cannot get this to work.
find *.trc -mtime +31 -print| xargs rm -f {}
find *.trc -mtime +31 -print -exec rm -f {} ;
well i have just started with shell scripting...how to find all child processes of a parent process given to script as argument.
View 10 Replies View RelatedI'd like to pass the following arguments to a bash script in any order:
Code:
myscript -l <country> -r <file1> <file2> ... -o
I read the argument list in a switch shift loop. I figured out how to read the filelist but only if -f is the last option.
how to position the file list anywhere in the argument list?
The find command is taking too long on my machine to complete. When I use time command, I find that sys time and user time are too small as compared to real time. Is my find process not getting scheduled properly?
I interrupted the neverending find command and got the following statistics:
Real time : 5min
Sys time : 1.1 sec
User time : 3 sec
I was running
find / -name ls 2>/dev/null
The image disk boots OK and comes to the screen that gives the option to try or install. I opted for the "try Ubuntu" once, but got a long list of i/o errors. Tried the install option, and same thing. The install did get to an apparent Ubuntu background, but never any further prompts. Is the iso bad? I'm trying to install on a Dell Inspiron 7500. Currently has Win2000 loaded.
View 4 Replies View RelatedI was on a car trip earlier, but we were stuck in traffic. The stop-go stop-go kind of BS. I pulled out my 9.10 laptop and figured I'd scan for wifi networks and see how good America was at securing their networks. (I work in IT support so it's one of those things I preach to no end yet people rarely listen).
I was using wifi radar, and picked up a truckload of networks every time we'd stop. But something didn't sit well with me. When I click on the network manager icon in the top gnome panel to see what networks were available, it never seemed to refresh.
Example - the first 5 networks I saw were 1, 2, 3, 4, 5. We would stop-go more and more and miles later when I'd see more networks in the area show up in wifi radar, yet hit my network manager, I'd STILL see networks 1, 2, 3, 4, 5 and not 30, 31, 32, 33, etc like I expected.
What kind of refresh time or cache or whatever does network manager have? I just didn't understand why I was seeing the original networks from 15 minutes/miles ago and it never seemed to update.
I've got a new hard drive, formatted it to ext3, and made a check for bad blocks using e2fsck.
It gave me this:
Quote:
I just would like to know where i can find how many bad blocks were found (perhaps one if it is using singular in sentence "Updating bad block inode."?), and what is/are the number(s) of located bad block(s).
I downloaded rpm so far but my only problem is I don't know what apps there are for it?
View 14 Replies View RelatedI'm trying to write a base script which will divide an argument by 10 and then use that argument in another program. Since my argument can be a floating point number, I used bc to accomplish this. Here's an example of a simplified version of what I have so far:
<code>NUM=$(echo "scale=25;$1/10" | bc)
#make sure the first argument was formatted correctly
if [ $? -ne 0 ]
[code]...
i'm trying to resize my album art that is dispersed through various artist/album folders. They are mostly 200x200, but i want to make all of them the same size. The code i'm trying to use is,
Code:
find -iname "cover.jpg" -execdir convert -resize 200x200 {}
or
Code:
find -iname "cover.jpg" -execdir convert {} -resize 200x200
i'm getting the error,
Code:
find: missing argument to `-execdir'
on both whats wrong with my syntax.
How to find and list files and directories present the current directory which were created in, say, years 2005, 2006, and 2009 and then move them to some other location, for example, /backup. Yes, I need to list them and move simultaneously. We can use:
Code:
find . -mtime n {};
but that n is troublesome for me to figure out files/directories created in years 2005, 2006, and 2009, for instance. Is there any way to match exactly by Year Value rather than calulating the "n" (days * 24 Hours)?
System Info:
SunOS 5.8 Generic_117350-06 sun4u sparc SUNW,Ultra-Enterprise
How can I find a list of files that are named duplicates i.e. have same name but in different case that exist in the same directory?
View 7 Replies View RelatedI use find / -name myfile to search files. But it will print out a very long list such as follow:
Code:
...
find: /var/empty/sshd: Permission denied
find: /etc/audit: Permission denied
find: /etc/httpd/conf/ssl.crl: Permission denied
find: /etc/httpd/conf/ssl.crt: Permission denied
[code]....
Where can i find a list of cronjob return codes for linux/unix
View 1 Replies View RelatedWhere would i find the list of distribution codes.For example.Code:samba-32bit-3.4.2 -1.1.3.1.x8664.rpmIn above rpm file it is indicated that its release is 1.1.3.1 .The rpm is meant to be run for opensuse.Where would i get the linking of release number and In simple words How would i guess distribution by merely looking at rpm name?
View 2 Replies View Relatedcommand to find list of table spaces in oracle in unix
View 1 Replies View RelatedWould someone be able to point me in the direction to find a list of update releases for Redhat Linux v5?
View 1 Replies View RelatedWhen I run updates I get a long list of packages for which it says 'The following package updates will NOT be installed'. I'm wondering why not?
The only thing I can think of is I followed the guide in a sticky thread in the Multimedia forum to get codecs installed, and part of that is to change the vendor of some Opensuse packages to packman.
Code:
~> sudo zypper up
Retrieving repository 'openSUSE-11.2-Update' metadata [done]
Building repository 'openSUSE-11.2-Update' cache [done]
Retrieving repository 'packman' metadata [done]
Building repository 'packman' cache [done]
code....
just start Ubuntu 9.04 said: File system chek failed a long is beging saved /var/long/fsck/checkfs if that location is writable Please repair the file systmen manually A maintenance shell will now be started Ctr+ D terminate this shell and resume system boot. Give root password for maintenance or type Control +D to continue. I did Ctr+D , and after login said , that can not find /home. I starte with the live cd:
[Code]....
I know I can do find . -type f, but that includes binary file and I couldn't find a way to exclude them with find
View 4 Replies View RelatedI'm just wondering if there is an easy way I can generate a list of RPM packages which have been forcefully installed on the system (got a couple of servers transitioned).
All servers are RedHat-5 if that matters.
How can only directories be listed, that do not have another child directory?
Imagine a structure like /A /A/AA /A/AB /A/AB/ABB /B /C /C/CC /C/CC/CCC /C/CC/CCC/CCCC I would like to use find to list only /A/AA /A/AB/ABB /B /C/CC/CCC/CCCC.
The starting point would be find . -type d, but neither -mindepth nor -maxdepth can be used, can -noleaf help (I could not get it to react the way I wanted it to)?
I am using find to search for .tgz files modified more than 7 days ago and delete them.find /directory/ -iname backup*.tgz -daystart -mtime +7 -exec rm -rf {} My problem is that find will go through the content of tarball as well and list all content. I want to only search main tarball and delete it if older than 7 days.
View 4 Replies View RelatedHow can I convert a file with a lot hex numbers into the decimal?
Example: file1
0x59999
0x5acdc
0xffeff
I want to start $ cat file1 | util | cat >file2 and get file2 with smth like
[Code]...
Not long ago I lost all sound, but I got it back eventually-the system wasnt snesing my usb speakers.
Now its stopped recognising them again and I cant remember how I got it back before.
How do I find a list of USB devices?
how to set the tcp ip parameter while linux boots up in my board.
Currently i am giving it like : tcp ip=:::::eth0:dhcp
If i have my own static ip and its corresponding mac-id can i change it for my board when i boot up.