I'm trying to turn a line like this to using sed
I'm not really good with regex and I'm looking for some help with the sed
command.
/Application/Lockscreen/ @smiths
/Application/BlueLock/ @egoists
to
path: */Application/Lockscreen/* @smiths
path: */Application/BlueLock/* @egoists
I would match on the first word [^ ]*
then add the pre- and suffix to it &
:
$ sed 's/[^ ]*/path: *&*/' input.txt
path: */Application/Lockscreen/* @smiths
path: */Application/BlueLock/* @egoists
Or if it makes more sense in your context replace the space with '* '
and the beginning ^
with 'path: '
(order matters):
$ sed 's/ /* /; s/^/path: */' input.txt
path: */Application/Lockscreen/* @smiths
path: */Application/BlueLock/* @egoists