![]() |
|
|
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 |
| lines searching >> | neverhood | Shell Programming and Scripting | 2 | 01-18-2009 07:39 AM |
| searching and storing unknown number of lines based on the string with a condition | swamymns | Shell Programming and Scripting | 7 | 05-13-2008 02:02 AM |
| removing particular lines ending with a .cnt extension in a text file | ramky79 | SUN Solaris | 2 | 03-03-2008 05:17 AM |
| Delete lines ending in "_;" using sed | turbulence | Shell Programming and Scripting | 12 | 01-17-2008 06:51 PM |
| sed searching across lines | miechu | Shell Programming and Scripting | 11 | 10-03-2006 05:27 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Searching for lines ending with }
I'm trying to search for lines ending with "}" with the following command but am not getting any output. Code:
grep '\}$' myFile.txt I actually want to negate this (i.e. lines not ending with "}"), but I guess that should be easier once I find the command that finds it? |
|
||||
|
this should do the work (put it inside a script) : Code:
#!/bin/ksh
file=$1
typeset -i lineno=0
cat $file |
while read line
do
lineno=lineno+1
nline="${line%\}}"
if [ "$nline" != "$line" ]
then
echo "$lineno ends in }"
fi
done
|
|
||||
|
Quote:
Code:
grep -v '}$' myFile.txt Regards |
|
||||
|
Quote:
BTW still can't understand why grep doesn't match this? ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|