Tldp chapter on string manipulation
http://tldp.org/LDP/abs/html/string-manipulation.html
Some reference tables
http://tldp.org/LDP/abs/html/refcards.html
Actually, technically the use of # might be a better fit,
/ is replacement, but since 'nothing' after it replace with nothing
Sorry, didn't explain that very well
${video/*__/foo_}
Would give you
foo_15000.mp4
${video/*__/}
'nothing' after the second slash, so in effect 'deletes' the pattern
${video#*__}
Same result, less typing
The awk deserves a quick explination
The -F , is defining the feild separator(s)
[_.] is 'special' in essence it means
_ or .
Now for the print part
NF is a special internal variable to awk,
For each new record (usually each line by default ) it counts the Number of Fields, and sets NF to that value
For fun, replace the $(NF-1) with NF, you should get a number
now do
Code:
NF" "$NF" "(NF-1)" "$(NF-1)" "(NF-2)" "$(NF-2)
that should give you an idea of what is going on