help... get single word from file
hey
I'm doing a little test. i want to find single word within a file and put it in a variable. but i dont know how. Heres an example of what i want to do. test=`grep Fedora /etc/issue` but this gets the hole line. echo $test #Fedora Core release 2 (tettnang) how do i get Fedora only? thanks |
test = "Fedora" (tee-hee)
Otherwise, grep's -o switch will return only the matching part of a line, try that. John |
test=`sed -n '/Fedora/ i Fedora' /etc/issue`
I don't really get what you want, though... Yves. |
I guess that "Fedora" is only an example, and that he's searching with a regexp or with a list of search terms in a file, so he needs to know which exact search term produced the hit.
John |
All times are GMT -5. The time now is 08:21 AM. |