bash how to make directories with names in .txt file code example
Example: bash make directories using specific text from filenames
for file in /input/directory/search_pattern; do
substring=${file:start#:length}
mkdir "/output/directory/prepended_text_${substring}_appended_text"
done
filename_ABC_123.txt
filename_DEF_123.txt
filename_GHI_123.txt
some_other_file_in_the_directory.txt
for file in ./*123.txt; do
substring=${file:11:3}
mkdir "/output/directory/prepended_text_${substring}_appended_text"
done
prepended_text_ABC_appended_text
prepended_text_DEF_appended_text
prepended_text_GHI_appended_text