Ignore the 255 character limit of command line

Hi

I would just like to ask if there is a way for UNIX to ignore/overcome the 255 character limit of the command line?

My problem is that I have a really long line of text from a file (300+ bytes) which i have to "echo" and process by adding commands like "sed" to the end of the line, like the following:

echo "xxx really long line of text xxx" | sed -e s/xxx/yyy/g

I have read in here that there are character limits (depends on system), and tested the system I'm using and indeed, it can only process commands not exceeding 255 chars. Have also read on changing the values of ARG_MAX (limits.h) but unfortunately, my access has no permission on changing those values.

Is there a way to overcome this limit without changing system parameters? Like setting a temp buffer for the string of text/commands?

Appreciate any feedback, thanks.

First of all: what OS, what shell, ...
Second: how about putting the line in a script?

1 Like

Why not just pass the file directly to sed?

Hi pludi,

Using HP-UX, /bin/ksh.
Yes, im using a script and just doing command line to manually test, I store the line in a variable, like so:

 echo $line | sed -e 's/xxx/yyy/g'

but i still get this upon execution:

sed: Function s/xxx cannot be parsed.

I think the last parts of the command are not read anymore, due to the character limit.

Thanks.

---------- Post updated at 07:44 PM ---------- Previous update was at 07:28 PM ----------

Hi CarloM,

I'm not sure how to do that. Is there a syntax? I'm used to just piping it in after other commands.

Thanks.

Just sed 'stuff' filename - runs sed on every line in the file.

Just to make this clear:

There's no way to "ignore" argument length limits or argument size problems. That's a system limitation. 255 characters is an unusually severe limit, but there's always a limit. No shell syntax is ever going to fit a 10-foot truck under an 8-foot tunnel.

I've seen people pile on more and more braces, backticks, and eval until the shell stops saying "too many arguments" but it's still a 10-foot truck and 8-foot tunnel. If you made it fit, you must have wrecked the truck.

If it won't fit as an argument, you have to pass it by other means, like a file.