Skip to main content

Thread: Add character string in filename after fifth character


i have nice little script have written replacing strings in filenames.

http://jamesisin.com/a_high-tech_ble...naming-script/

works great time can use regex identify string replaced. problem i'm facing have bunch of files 2 (variable) bits need keep sandwiched no intervening string (not single character).

so, know have 2 numbers, dot, , 2 numbers (totaling 5 characters) @ beginning of each filename before want new string placed (such 01.05other stuff needed.flac).

have seen sed used similar within text files, i'm not familiar sed.

suggestions , samples welcome. thanks.

hi jamesisin.

since using parameter substitution already, may extract sub strings using position , length.

instance:
code:
$ var="01.05other stuff needed.flac"  $ echo ${var:0:2} 01  $ echo ${var:3:2} 05
hope helps.
regards.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Add character string in filename after fifth character


Ubuntu

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues