LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 02:36 PM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 70
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, 02:57 PM   #2
AlucardZero
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, 08: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



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-07-2015 11:44 PM
grepping all the lines between 2 patterns raghu123 Programming 2 11-04-2008 01:24 AM
grepping lines... visitnag Linux - Newbie 4 06-26-2008 01:22 PM
grepping different lines..... visitnag Linux - Newbie 5 04-12-2008 09:35 AM
question about grepping something Grafbak Programming 6 03-01-2005 01:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:29 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
Open Source Consulting | Domain Registration