LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,808

Rep: Reputation: 604Reputation: 604Reputation: 604Reputation: 604Reputation: 604Reputation: 604
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
binary_pearl
Member
 
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.

--Shaun
 
  


Reply


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


All times are GMT -5. The time now is 12:41 PM.

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