Commands and Common Expressions-ls/grep
I didn't know exactly where to post this but since I am a newbie studying for the Linux+ figured here was best choice...
Scenario: I have a file named novowel, with the following words; efgh ijkl abcd I won't to run the expression [^abcd] which should bring all the words that don't include abcd. I tried ls [^abcd] novowel: but got ls: cannot access [^abcd]: No such file or directory novowel and I tried ls novowel [^abcd] but got same error. I tried grep [^abcd] novowel and got - efgh ijkl abcd so it brought back all the words. Just trying to find command that works with the [^...] expression. Thanks in advance |
Code:
sed 's/ /\n/g' testfile | grep [^abcd] |
Yes, but what if I wanted to use the command to search a document. I would not have the flexibility to move anything around? I'll keep looking for a command that works with
[^abcd]. If you or anyone have a different input I would appeciate it. |
rtrahan,
Can you explain your need on a more elaborate way? Code:
just trying to find command that works with the [^...] expression. |
Using awk you can split each line of a file into words and each word into single characters. If and only if a character in a word does not match the complement of abcd, the word is deleted:
Code:
awk '{ |
All times are GMT -5. The time now is 07:07 PM. |