Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search in a very long line

Status
Not open for further replies.

laurentiuz

Programmer
Oct 26, 2002
14
0
0
FR
Hi everybody,

can you tell me how can I find a string in a file which has
very long lines.
I've tried grep but it respond :"can't grep line exceed ...
bytes'
I've tried a cat file_name | grep string : same thing
I tried even vi - but it shows me onli a line and I can't do a search ...
Thank you in advance !
 
Try using perl then - it doesn't have low limits on the lengths of files / lines.

What do you want to do with a line once you've found it?
 
if on Solaris, try /usr/xpg4/bin/grep
Might have better luck.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I just want to know if the string exist in that file
 
In bash and similar shells
Code:
perl -n -e 'if ( /string/ ) {exit(1);}' filename
if [ $? == 1 ]; then
  echo found
fi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top