My sed command is,
sed '/(.*:)/d' <<< 'abcd:bcde:cdeaf'
It must return,
bcde:cdeaf
(i.e.) all characters before the first colon in the line and the colon itself must be removed.
But this is not removing anything.
My confusion arises mainly due to,
1) Does parens for pattern matching need to be escaped inside sed regex-es?
2) In either case(with escaping/no escpaing), it is nt working. I tried,
sed -E '/\\(.*:\\)/d' <<< 'abcd:bcde'
sed 's/[^:]*://'
. And you're notd
eleting the input line, by the way, you're modifying it with as///
ubstitution command. You have to replace the first not colon bit and the colon that follows it with nothing at all. – mikeserv Sep 29 '15 at 2:29printf "%s\n" "${line#*:}"
... – jasonwryan Sep 29 '15 at 2:31while read line
that gets the$line
, probablysed
should be preferred. – mikeserv Sep 29 '15 at 2:33