Computing.Net > Forums > Unix > searching for lines

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

searching for lines

Reply to Message Icon

Name: somesh
Date: November 7, 2005 at 03:11:39 Pacific
OS: hpunix
CPU/Ram: p4
Comment:

i want to serch lines which do not begin with #

someshwar



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: November 7, 2005 at 07:05:20 Pacific
Reply:

Here is one way:

#!/bin/ksh

while read line
do
# ignore any line commented out.
[[ $line = "#"* ]] && continue
# place the rest of your script here
done < myfile


0

Response Number 2
Name: cdac1000
Date: November 9, 2005 at 03:37:17 Pacific
Reply:

cat filename | grep -v "^#"


0

Response Number 3
Name: WilliamRobertson
Date: November 15, 2005 at 15:51:28 Pacific
Reply:

Or

grep -v "^#" filename


0

Response Number 4
Name: GordonBe
Date: November 30, 2005 at 12:19:47 Pacific
Reply:

more file.txt|grep -v "^#"



rape movies
Mr.Gordon BE


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


getting awk to print name... QNX 4.25 Photon install



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: searching for lines

Searching for more then one word www.computing.net/answers/unix/searching-for-more-then-one-word/5027.html

search for files & directories www.computing.net/answers/unix/search-for-files-amp-directories/4600.html

unix script to search for a decimal www.computing.net/answers/unix/unix-script-to-search-for-a-decimal/8221.html