You want basename: $ basename /tmp/accept/FLWS14UU. Png FLWS14UU.png.
Wow, thats really simple. Thanks for the quick answer! – Mossen Jan 7 '10 at 19:25.
Basename works on one file/string at a time. If you have many strings you will be iterating the file and calling external command many times. Use awk $ awk -F'/"' '{print $(NF-1)}' file FCCY.
Png FLWS14UU. Png STSMLC. Png or use the shell while read -r line do line=${line##*/} echo "${line%\"}" done.
Newlist=$(for file in ${list} ;do basename ${file}; done).
Using basename iteratively has a huge performance hit. It's small and unnoticeable when you're doing it on a file or two but adds up over hundreds of them. Let me do some timing tests for you to exemplify why using basneame (or any system util callout) is bad when an internal feature can do the job -- Dennis and ghostdog74 gave you the more experienced BASH answers.
Sample input files. Txt (list of my pics with full path): 3749 entries external. Sh while read -r line do line=`basename "${line}"` echo "${line%\"}" done /dev/null real 0m4.135s user 0m1.142s sys 0m2.308s $ time sh internal.Sh 1>/dev/null real 0m0.413s user 0m0.357s sys 0m0.021s The output of both is identical: $ sh external.
Sh | sort > result1. Txt $ sh internal.Sh | sort > result2. Txt $ diff -uN result1.
Txt result2. Txt So as you can see from the timing tests you really want to avoid any external calls to system utilities when you can write the same feature in some creative BASH code/lingo to get the job done, especially when it's going to be called a whole lot of times over and over.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.