I have these excel files in a user directory:
430_XFRtoDML.xlsx 431_XFRtoDML.xlsx 440_XFRtoDML.xlsx 450_XFRtoDML.xlsx 451_XFRtoDML.xlsx 465_XFRtoDML.xlsx 500_XFRtoDML.xlsx Path: /home/user/home/user
I want to write a script to create a text file 'bit_list.txt'bit_list.txt mentined below. It should remove the xlsx extension followed by ':5. ' and:5. and first 3 number from that file. e.g. '430_XFRtoDML:5. 430'430_XFRtoDML:5. 430
filenames=`ls *.xlsx` for eachfile in $filenames do echo $eachfile done Expected output:
$ cat bit_list.txt 430_XFRtoDML:5. 430 431_XFRtoDML:5. 431 440_XFRtoDML:5. 440 450_XFRtoDML:5. 450 451_XFRtoDML:5. 451 465_XFRtoDML:5. 465 500_XFRtoDML:5. 500