![]() |
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 |
| 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 |
| deleting lines using awk-best way? | satnamx | Shell Programming and Scripting | 3 | 08-29-2007 07:24 PM |
| Deleting Lines from .CSV Files | 009satya | Shell Programming and Scripting | 1 | 11-13-2006 03:30 PM |
| deleting lines | ajnabi | Shell Programming and Scripting | 8 | 05-02-2003 11:50 AM |
| deleting lines | supercbw | High Level Programming | 1 | 05-06-2002 12:53 PM |
| Deleting Multiple Lines with sed | rambo15 | Shell Programming and Scripting | 1 | 02-16-2002 06:19 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help deleting lines with SED.
I take the /etc/passwd file and print it out, but I only want the lines that end with sh.
I have Code:
cat /etc/passwd | sed '/sh/!d' So I added $, which I thought matches the ends on lines, but its not working, like for example I have have file "sshd:x:100:65534::/var/run/sshd:/bin/false", that does not end in sh Code:
cat /etc/passwd | sed '/$sh/!d' |
|
||||
|
For those who do not know - UUOC = useless use of cat. Don't use cat when you can redirect a file into stdin of a command. If that gets repeated thousands of times in a script it eats system resources - like inside a loop.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|