Hi,
How do i Print anything after a ':'
Ex :
file1: 1235131(rs32553)
I want to print out "1235131(rs32553)"
how do i do it. I know we can do this using awk but looking for the right syntax.
Any help appreciated.
Thanks,
Ram
Hi,
How do i Print anything after a ':'
Ex :
file1: 1235131(rs32553)
I want to print out "1235131(rs32553)"
how do i do it. I know we can do this using awk but looking for the right syntax.
Any help appreciated.
Thanks,
Ram
echo 'file1: 1235131(rs32553)' | sed 's/.*:\(.*\)/\1/'
echo "file1: 1235131(rs32553)" | sed 's/^.*://'
sed works, too.
Another way with cut :
echo "file1: 1235131(rs32553)" | cut -d: -f2-
Jean-Pierre.
echo "file1: 1235131(rs32553)" | awk ' sub("[^:]*:","") '
echo "file1: 1235131(rs32553)" |awk -F: '{print $2}'
$ echo "file1: 1235131(rs32553)"|{ read; echo "${REPLY#*: }";}
1235131(rs32553)
Hi.
Some versions of grep allow an option -o that can be useful in such cases:
#!/bin/sh
# @(#) s1 Demonstrate grep "print only match" option.
echo 'file1: 1235131(rs32553)' |
grep -o '[^:]*$'
exit 0
Producing:
% ./s1
1235131(rs32553)
cheers, drl