How to solve issue Argument list too long in grep command?

127 Views Asked by At

How to solve issue Argument list too long in grep command?

I need to execute grep command

grep '^ORA'  '/log/bssuser/CDR/Postpaid_CDR_Log/'*.log > output.txt

I have error : -bash: /usr/bin/xargs: Argument list too long

1

There are 1 best solutions below

0
Fravadona On

For handling a wild number of files you need to use find:

find /log/bssuser/CDR/Postpaid_CDR_Log/ -type f -name '*.log' \
     -exec grep '^ORA' {} + >  output.txt