Split a string using a string as delimiter in awk
No need to use awk
, you can do this with your POSIX shell like so:
$ var="/as/asdasd/asdasd/root/asdqwe/asd/asssdd/"$ echo ${var%/root/*}/as/asdasd/asdasd$ echo ${var#*/root/}asdqwe/asd/asssdd/
Update
If your Solaris version of awk
isn't working (probably because FS must be chars not strings), then try this method using split()
awk '{split($0,a,"/root/");$1=a[1] "/"; $2=a[2]; print $1,$2}'