![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using first word and print their contents using awk | cdfd123 | Shell Programming and Scripting | 6 | 10-10-2007 04:12 AM |
| search for the contents in many file and print that file using shell script | cdfd123 | Shell Programming and Scripting | 3 | 10-07-2007 11:17 PM |
| ls command to print fifo of contents (or perl) | jerardfjay | Shell Programming and Scripting | 1 | 04-06-2006 03:01 PM |
| Creating file contents using contents of another file | ReV | Shell Programming and Scripting | 21 | 02-24-2006 10:25 AM |
| How to print contents on the screen? | aadba | UNIX for Advanced & Expert Users | 1 | 03-22-2004 10:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
awk - print file contents except regex
Hello,
I have a file which has user information. Each user has 2 variables with the same name like Email: testuser1 Email: testuser1@test.com Email: testuser2 Email: testuser2@test.com My intention is to delete the ones without the '@' symbol. When I run this statement awk '/^Email:/&&!/@/' <FileName>. It prints all the Email variable without the @. But when I try to run this one expecting to print all the lines except Email without @. it prints everything. awk '/cn:/&&!/@/ { copy=1 }; copy { print } ' <filename> Please advise. -Regards, |
|
||||
|
There are other lines which I would like to print/list
If the File contains First Name: Test Last Name: User1 Email: testuser1 Email: testuser1@test.com after running awk I would that to be print as First Name: Test Last Name: User1 Email: testuser1@test.com |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|