![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk how to print if the search pattern contains speace | McLan | Shell Programming and Scripting | 1 | 04-09-2008 09:39 AM |
| Shell script to search through numbers and print the output | cdfd123 | Shell Programming and Scripting | 8 | 10-30-2007 04:40 PM |
| using awk to search and print output | cdfd123 | Shell Programming and Scripting | 5 | 09-18-2007 05:00 AM |
| Can I search columns and print lines? | Ant1815 | UNIX for Dummies Questions & Answers | 2 | 04-26-2007 07:01 AM |
| Search for text and print the next line | alijassim | Shell Programming and Scripting | 2 | 08-17-2004 06:08 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
awk search and print .doc extensions
Hello,
I'm trying to grab all lines in a file that match the extension using the following command: awk '/.doc/' Input.csv > WordFiles.dat This works, but if a line contains "doc" it still prints the line. I want to print only the lines with ".doc" Can someone show how to pick up only ".doc" thanks |
|
||||
|
In a regular expression, just a dot means any character. Backslash it to get the literal meaning.
You might want to make the regular expression even more constrained (say, require there to be no alphabetic after the "doc"). awk is overkill, this is a typical grep problem. Code:
grep '\.doc' input.csv >WordFiles.dat |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|