Yes that's right, thanks for the advice. I'll look into that command now
On Friday, 25 January 2013 10:35:27 UTC, tid wrote: > > have a look at the 'dirname' command - you can extract a file's > directory name with that. In your example > below you look as if you're trying to extract the directory two levels > above your file - is that what you want? > > Tid > > On 25 January 2013 03:34, Andrew Taylor <[email protected] <javascript:>> > wrote: > > Thank you so much for your help, it seems so obvious to see it written > > down!. > > > > Could you help with one other thing? I'm trying to extract the directory > > name to form a description for each path returned. This is what I have > so > > far: > > > > for OUTPUT in $(find `pwd` -name google_transit.zip) > > do > > while IFS='/' read -ra $OUTPUT; do > > echo " <bean > > class=\"org.opentripplanner.graph_builder.model.GtfsBundle\">" > > echo " <property name=\"path\" > value=\""$OUTPUT"\" > > />" > > echo " <property name=\"defaultAgencyId\" > > value=\"""${OUTPUT[6]}""\" />" > > echo " </bean>" > > done > > done > > > > What am I doing wrong? > > > > I was trying to follow this example: > > > http://stackoverflow.com/questions/918886/split-string-based-on-delimiter-in-bash > > > > > A line in OUTPUT could for example be the below. In this case I'd like > to > > extract "OId_LG" > > > "/home/andyt/projects/django-stringer/txc/OId_LG/GTFS/google_transit.zip" > > > > > > Thanks! > > > > > > > > On Thursday, 24 January 2013 13:24:45 UTC, Hermenegildo Konstantin > wrote: > >> > >> > >> > >> Dana četvrtak, 24. siječnja 2013. 02:58:42 UTC+1, korisnik Andrew > Taylor > >> napisao je: > >>> > >>> Hi, > >>> > >>> I'm struggling to figure out if I can do this in bash - can anyone > offer > >>> me some advice? Within this folder: > >>> > >>> /projects/django-stringer/txc > >>> > >>> I have about 30 sub-folders. each one contains a folder within a > folder > >>> that contains a file called "google_transit.zip" I'd like to print out > this > >>> list of paths in full if I can. An example path would be: > >>> > >>> > /home/andyt/projects/django-stringer/txc/OId_CW/GTFS/google_transit.zip > >>> > >>> Thanks! > >>> > >>> Andy > >> > >> > >> see here : > >> > >> > http://stackoverflow.com/questions/246215/how-can-i-list-files-with-their-absolute-path-in-linux > > >> > >> find `pwd` -name google_transit.zip > >> > >> > > -- > > -- > > You received this message because you are subscribed to the Linux Users > > Group. > > To post a message, send email to [email protected]<javascript:> > > To unsubscribe, send email to > > [email protected]<javascript:> > > For more options, visit our group at > > http://groups.google.com/group/linuxusersgroup > > References can be found at: http://goo.gl/anqri > > Please remember to abide by our list rules (http://tinyurl.com/LUG-Rulesor > > http://cdn.fsdev.net/List-Rules.pdf) > > > > > > > -- -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup References can be found at: http://goo.gl/anqri Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf)
