problems with grep on solaris 5.8


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers problems with grep on solaris 5.8
# 1  
Old 07-01-2004
Data problems with grep on solaris 5.8

Hi all,

I have a problem when i grep for a particular field among all fhe files in the directory.

if i do an ls -l field *
i can find it.

however at the moment the number of files in the directory are close to 28000 and it returns an

ksh: /usr/bin/grep: arg list too long

Assuming i just want to grep all files with a date at say Jun 28 as the range and not all of them, how do i do it on the command line?

Regards,
Alvin
# 2  
Old 07-02-2004
I am not sure by your question if you are looking for file names or contents of a file. 'find' or 'xargs' is probably what you are looking for. With find you could do something like:

find ./ -mtime 3 -print

This will find all files from 3 days ago (June 28th currently). By the time you read this you may have to adjust the number.

You could modify this to:

find ./ -mtime 3 -exec grep field {}\;

This will look for the word 'field' in all the files.

The other option is to use xargs, which may resolve the "arg list too long" issue like so:

ls * | xargs grep field

Hopefully one of these works for you or leads you down the right path.
# 3  
Old 07-03-2004
Does this help

ls -l|grep "Jun 18"
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep or cat The Whole Directory PROBLEMS :(

Hi Guys This is my first post so I am not sure how things go here. I'm sorry if I'm breaking the rule or something. Feel free to correct me about that :) So as I was saying... I'd been trying to grep this folder containing 900,000 txt files but seems no luck. I get either "No such file... (6 Replies)
Discussion started by: Nexeu
6 Replies

2. Shell Programming and Scripting

Problems with using grep to make backups to a different directory

I am trying to program a script that is using grep to find lines in a file in my home directory, and then use a pipe command to copy what is shown into different files in a different directory to create backup files. When I run it, though, it only creates a copy of the file that grep was going... (7 Replies)
Discussion started by: sammythesp3rmy
7 Replies

3. Shell Programming and Scripting

Problems to print specific lines with awk and grep...HELP!

Hi all I have data like this: model: 1, misfit value: 0.74987 1 1.182 1.735 2.056 1.867 2 0.503 1.843 2.018 1.888 3 2.706 2.952 2.979 1.882 4 8.015 3.414 3.675 1.874 ... (1 Reply)
Discussion started by: fedora2011
1 Replies

4. Shell Programming and Scripting

Execution problems with grep command in scripting

Hi All, I was looking for grep command option which can exactly matches the word in a file, for examples you may be seeing one word that is also in another word, there might be lkk0lv23 and a lkk0lv234 in which case lkk0lv23 will put BOTH hosts from the grep in. I was using this in a bash... (2 Replies)
Discussion started by: bobby320
2 Replies

5. Shell Programming and Scripting

Problems with Sed/awk/grep and line endings

Hello I have created the following script, which is designed to manipulate a text document: #!/bin/sh # Get 3 lines, (last of which is "Quantity"); adjust order; put all three on one line with tabs. FILENAME=~/Desktop/email.txt LIST=$(grep -B2 "Quantity" ${FILENAME} |awk 'BEGIN { FS = "\n"; RS... (6 Replies)
Discussion started by: benwiggy
6 Replies

6. Shell Programming and Scripting

Problems in Usage of grep

Hi all, I have a file resp_cde.ats which has values as:- APPDIR=C:\Program Files\Cogny\cert PUBSDIR=C:\Program Files\Cognoy\cert\documentation TOURDIR=C:\Program Files\Cognoy\cert\tour DATADIR=C:\Program Files\Cognoy\cert\data Now I use the grep command in a shell script:- x=`grep... (2 Replies)
Discussion started by: vikasrout
2 Replies

7. Solaris

Problems installing Solaris 10

I just built my new computer with a q6600 quad core, 4 gig ram, Nvidia vidoo card but when I try to install the latest Solaris 10 on it the keyboard is not being detected when the installation starts so I'm unable to go complete the installation. First I tried a USB keyboard and it didn't work,... (2 Replies)
Discussion started by: isomorphic
2 Replies

8. UNIX for Dummies Questions & Answers

Problems with grep and XML

I'm trying to use grep on XML files. The same grep expressions work on plaint text files but not on XML files (which of course are plain text files). Actually, these expressions work on XML files saved in DreamWeaver, but not when the same files are saved in XML Spy. I want grep to treat these... (4 Replies)
Discussion started by: pauljohn
4 Replies

9. Shell Programming and Scripting

command substitution problems with csh using grep

I am trying to set a command into a variable in a csh script using command substituion with ``. I am having a problem with ps command combined with grep. The command is as follows (shows processes running with the word gpts in them). /usr/ucb/ps axwww | grep gpts this works fine at the... (2 Replies)
Discussion started by: voodoo31
2 Replies

10. UNIX for Dummies Questions & Answers

problems about installing Solaris 8 on PC

1. OSes coexistence can i install solaris 8 on my pc's 3th primary harddisk partition without damage the user and boot datas of installed operation system? and does i have to install Solaris 8 within several G(such as 8G) size of the harddisk? the following is partition table of my harddisk: ... (2 Replies)
Discussion started by: samprax
2 Replies
Login or Register to Ask a Question