LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-22-2009, 10:49 PM   #16
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 237Reputation: 237Reputation: 237

Quote:
Originally Posted by urban.yoga.journeys View Post
as i understand it, and i'm no expert so please bear with me, $line is the entire line correct?
which would mean that *PATTERN* would also have to be the entire line to match, if it were only a word or part of a word, there would be no match.
yes
Quote:
or does the while-read-line construct read word per word? AFAIK it reads entire lines, but like i said i'm no expert
to read per word, you can set it as you iterate the file
Code:
while read -r line
do 
 set -- $line
 for item in $@
 do
    echo "-->$item"
 done 
done <"file"
 
Old 11-23-2009, 01:12 AM   #17
urban.yoga.journeys
Member
 
Registered: Jun 2008
Posts: 31

Rep: Reputation: 16
ok thanks for that
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grep till second pattern rattlesnakejoe Programming 1 11-22-2009 08:09 AM
grep exact pattern kapila Linux - Newbie 11 08-06-2009 02:58 AM
grep till the 1st occurrence of a pattern raghu123 Programming 2 04-15-2009 05:47 AM
grep till the 1st occurrence of a pattern raghu123 Programming 1 04-15-2009 05:17 AM
using grep when the pattern contains a ! farmerjoe Programming 9 03-15-2005 11:04 PM


All times are GMT -5. The time now is 09:30 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration