awk command input string too long, limit

cat filename| awk '{ $1=""; print $0}'

in my file there are few lines that has more than 3000 characters per line and as soon as I run the above command it cores, strings core reveals that the awk is failing because input string too long, limit. can i get some help from the experts to find an alternative command for what I am trying to do.

Looks like your fields are space separated...

sed 's/^[^ ][^ ]*//' myFile

Hi,

What OS and version are you using?
What does your file look like?
What is the exact message?

Try if a bash/ksh/zsh shell can handle longer lines:

while read -r junk other; do printf "%s\n" "$other"; done < filename

Error Message shown below I used strings core >> coredumpfile and in that file I see the following error

#ch/
$  3
# h#
wbad switch yylook %d
Input string too long, limit %d
Input string too long, limit %d
Input string too long, limit %d
Input string too long, limit %d
cgotofn: notin; state = %d, n = %d
field %d: |%ws|
awk: %s near line %lld
awk:
 record number %g
SUNW_OST_OSCMD
awk: Usage: awk [-Fc] [-f source | 'cmds'] [files]
substr: m=%d, n=%d, s=%ws
split: s=|%ws|, a=%ws, sep=|%wc|
%.20g
@!e)f
,+f$h
/,f0f
C1f+p-f<
G(l/fh
A2f4}
O4}mf8
G.tnfj
@SS-sqf1xSS1y
M1z6
TTTTTT8
lfgf<
^^^^^^
"f^`of"
"fsftfv
{fxf
#f#f#f
#f#f#f#f#f#f#g#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f
#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#f#ff
yacc stack overflow
syntax error
bailing out
illegal statement
newline in regular expression
newline in string
string too long
newline in character class
string too long
 <=
 >=
 ==
 !=
 !~
 +=
 -=
 *=
 /=
 %=
print
printf

Any luck with the alternate suggested solutions to try?
I see you're on SunOS and trying to use awk . Any better luck with nawk or /usr/xpg4/bin/awk ?

Thank you so much, can you please explain me what exactly you are doing. by the way it did work and thank you so much. I would like to understand your code.

while read -r junk other; do printf "%s\n" "$other"; done < filename

Thank you once again.

nawk rocks !!! thank you thank you thank you, it worked like a butter !!!

1 Like

It is a while loop. In every cycle read a line into the two variables junk and other , where the first word lands in junk . The spaces around the first word are deleted. The source of the read is the file filename because the whole while-do-done block is redirected.
Then the variable other is printed.
The loop continues with the next read. It ends if the read fails, normally when it is beyond the last line (end of input reached).