trying to exclude hostnames ending in "s" from a host file:
# cat hosts
ssef
ssefd
ssefsfff
ssefsfs
# for x in `cat hosts`; do echo "${x/*s}" ;done
ef
efd
fff
#
How can I echo/or not echo only 'ssefsfs' ??
thanks
trying to exclude hostnames ending in "s" from a host file:
# cat hosts
ssef
ssefd
ssefsfff
ssefsfs
# for x in `cat hosts`; do echo "${x/*s}" ;done
ef
efd
fff
#
How can I echo/or not echo only 'ssefsfs' ??
thanks
sed -n "/s$/! s/s.*s//p" file
To print lines ending with s
sed -n "/s$/p" file
To print lines without s at end
sed -n "/s$/! p" file
thanks, exactly what i need
with awk,
awk '{ if( substr($0, length, 1) !~ /s/ ) { print } }' filename
Erm.... grep :rolleyes:
grep '[^s]$' hosts
Cheers
ZB