Hi,
try this :
If your string x contain a pipe then you have to change the FS variable and the line "z=$x......." to another character which surely not contains in x.
for example :
z=$x"@"$a"@"$b
y=`echo $z | awk ' BEGIN { FS="@"}
Hope, I can help you out by your problem !
x="abcdef1234.myfile"
echo "How many charakters do you want to discard in the front ?"
read a
echo "How many charakters do you want to discard at the end ?"
read b
z=$x"|"$a"|"$b
y=`echo $z | awk ' BEGIN { FS="|"}
{
y=substr($1,$2+1)
len=length(y)
y=substr(y,1,len-$3)
print y
}'`
echo "old_string "$x
echo "new_string "$y