bash script to parse variable file names

December 22, 2011 at 01:09:06
Specs: Windows XP
Hi, im new to batch scripting and i need help with extracting variable file names.
example file name: zxcs4g5m2, i need to extract the names after "zxc", which will be "s4g5m2"
i tried to build the script but it only display s4. Please help me. Thanks a million!

See More: bash script to parse variable file names

Report •


#1
December 22, 2011 at 07:20:23
The bash shell pattern matching can parse strings:

#!/bin/bash

var=zxcs4g5m2
t=${var#zxc*}
echo "$t" # should display s4g5m2



Report •
Related Solutions


Ask Question