Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-25-2011, 03:36 PM   #1
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Rep: Reputation: 69
A question about grepping lines more than a screen's worth width...

What If I wanted to scan a string like the following...

02jfijaoif==thata==asfe489qj=034jf[iqojf[iajse=fija=039jwaijefijaw=0iejf=0ieaj=0fjas0=ijdf0ijfjdifajs;ldfja;lskdfalskdfjaslkdfjsdajasldkfja's lkdja'skldjfj=30j[09jfsjdf[iasjd[fij=09j309jIJF

Anyhow just one giant string that's longer than my screen's width. If I simply copy and paste that string after a grep command, it seems that the terminal inserts newlines at the terminal's width and therefore not the whole string goes in.

Even if I insert a quote before the beginning of the string and then paste it in, terminal still reads in a newlines somehow and obviously says command not found, etc.

How do I grep for a long consecutive string like this?
Old 01-25-2011, 03:57 PM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
It should just work. Are you running bash? What Linux are you on and how old is it?
Old 01-25-2011, 09:36 PM   #3
Registered: Jul 2007
Location: Chicago Illinois
Distribution: SLES 10 SP2/SP3, SLES 11 SP1, OpenSUSE, Sabayon, Gentoo, Fedora 14, RHEL 3/4/5/6
Posts: 98
Blog Entries: 3

Rep: Reputation: 23
The problem probably is coming from the copy-and-paste. It's possible that the newlines are being inserted because the copy-and-paste copied the new lines literally. If your familiar with vi, you could put the text into a file and remove the newlines. Or actually put it in your favourite text editor and make sure it's all on 1 line of text.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash - question about grepping a specific time period xmichielx Programming 5 04-08-2015 12:44 AM
grepping all the lines between 2 patterns raghu123 Programming 2 11-04-2008 02:24 AM
grepping lines... visitnag Linux - Newbie 4 06-26-2008 02:22 PM
grepping different lines..... visitnag Linux - Newbie 5 04-12-2008 10:35 AM
question about grepping something Grafbak Programming 6 03-01-2005 02:28 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration