I want to split a large collection if text files. This is the script that i currently use
for file in *.txt
do
split -b 120k "$file" "$file"_
done
When the input file is
hello_world.txt
the splitted files would be
hello_world.txt_AA
hello_world.txt_AB
hello_world.txt_AC
i want it to be like
hello_world_AA
hello_world_AB
hello_world_AC
How do i do it in linux ?
In bash, an expression of the form
${variable%suffix}will expand to the contents of
variablewith thesuffixremoved from the end.You can use this when you specify the new file prefix to
splitlike this: