- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Scripting - /bin/grep: Argument list too long
Operating System - Linux
1823415
Members
2432
Online
109655
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2005 03:34 AM
тАО11-20-2005 03:34 AM
Scripting - /bin/grep: Argument list too long
Okay - go easy - just got back from Cabo San Lucas - so I'm not quite with it...
Anyway - being postmaster, I had a to of email - 38,458 to be exact in my little inbox....
I use Sendmai with Maildirs...
So, I tried this:
cd /var/mail/met.ca/gjwild/Maildir/cur
for i in `grep "To: postmaster" \`ls -l|grep "Nov" | awk '{print $9}'\` | awk -F:To '{print $1}'`; do rm -f $i; done
Unfortunately, I get:
/bin/grep: Argument list too long
So I tried
grep "Nov 11"
still no go...
So I had to reduce further:
grep "Nov 11 01"
That works...but that means I have to run it for everey hour for every day - there has got ot be a better way.
Thanks...Geoff
Anyway - being postmaster, I had a to of email - 38,458 to be exact in my little inbox....
I use Sendmai with Maildirs...
So, I tried this:
cd /var/mail/met.ca/gjwild/Maildir/cur
for i in `grep "To: postmaster" \`ls -l|grep "Nov" | awk '{print $9}'\` | awk -F:To '{print $1}'`; do rm -f $i; done
Unfortunately, I get:
/bin/grep: Argument list too long
So I tried
grep "Nov 11"
still no go...
So I had to reduce further:
grep "Nov 11 01"
That works...but that means I have to run it for everey hour for every day - there has got ot be a better way.
Thanks...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2005 04:47 AM
тАО11-20-2005 04:47 AM
Re: Scripting - /bin/grep: Argument list too long
Hi there Geoff, how are you my friend!
This is a relatively often heard (hurt ;-) problem.
Checking it out on www.google.com/linux
Searching for "Argument list too long"
Gives about a thousand hits
The general solution is to use 'xargs'.
You could also try rebuild a kernel with a change to:
include/linux/binfmts.h
:
#define MAX_ARG_PAGES 32
make it 64? more still?
You failed to specify which Linux/version.
There may be specific solution for whatever you are running.
Be sure to read: http://www.linuxjournal.com/node/6060/print
Greetings from Nashua NH,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2005 10:39 PM
тАО11-20-2005 10:39 PM
Re: Scripting - /bin/grep: Argument list too long
You can use a pipe with the xargs command to solve the "argument list too long" issue.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-21-2005 05:14 PM
тАО11-21-2005 05:14 PM
Re: Scripting - /bin/grep: Argument list too long
Geoff,
xargs would be the way to go...man xargs(1) and look-up its "-n" option also.
cheers!
xargs would be the way to go...man xargs(1) and look-up its "-n" option also.
cheers!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP