unix shell string manipulation examples 

Joined:
04/07/2009
Posts:
178

August 15, 2012 09:07:41    Last update: August 15, 2012 09:07:41
$ var='variable to be truncated'
$ echo ${var#vari}
able to be truncated
$ echo ${var% truncated}
variable to be
$ echo ${var#????}
able to be truncated
$ echo ${var%??????????}
variable to be

$ echo ${var} | sed 's/ truncated//'
variable to be
Share |
| Comment  | Tags