extract characters from a variable

Hewlett-packard / Hp proliant dl380 g5
July 21, 2010 at 05:46:49
Specs: HP-UX , B.11.11 U 9000/800
have the following line that I got doing a foreach var (`cat $ in / l_bb`)
/ Files/project00001/data100/TestCase/G40_B_2200_pow102_pcm04.inp
and I want to get character column 44-61

2200_pow102_pcm04

How do I do?
Forgive for my English I am Spanish

"La experiencia es algo maravilloso. Nos permite reconocer un error cada vez que lo volvemos a cometer.", Franklin P. Jones


See More: extract characters from a variable

Report •

#1
July 21, 2010 at 06:58:50
Use the unix cut command. You don't say, but it looks like you are using csh:

#!/bin/csh

set myline="/ Files/project00001/data100/TestCase/G40_B_2200_pow102_pcm04.inp"
set cutline=`echo "$myline"| cut -c44-61`
echo $cutline


Report •

#2
July 21, 2010 at 23:10:28
Thanks, that was exactly what I meant

"La experiencia es algo maravilloso. Nos permite reconocer un error cada vez que lo volvemos a cometer.", Franklin P. Jones


Report •
Related Solutions


Ask Question