Skip to main content
Fix error message and tags
Source Link
tripleee
  • 8k
  • 2
  • 37
  • 45

Create new file per line from txt file, avoid file name too long

I'm creating new file for every line of text in a .txt file

file=/tmp/textFile.txt
while IFS= read -r line
do
        printf "%s\n" "$line" > /tmp/"$line"txt
done < "$file"

I always get an error saying titlefile name too long, is there anyway to shorten the title for the new files to a certain number of characters?

Create new file per line from txt file

I'm creating new file for every line of text in a .txt file

file=/tmp/textFile.txt
while IFS= read -r line
do
        printf "%s\n" "$line" > /tmp/"$line"txt
done < "$file"

I always get an error saying title too long, is there anyway to shorten the title for the new files to a certain number of characters?

Create new file per line from txt file, avoid file name too long

I'm creating new file for every line of text in a .txt file

file=/tmp/textFile.txt
while IFS= read -r line
do
        printf "%s\n" "$line" > /tmp/"$line"txt
done < "$file"

I always get an error saying file name too long, is there anyway to shorten the title for the new files to a certain number of characters?

Source Link

Create new file per line from txt file

I'm creating new file for every line of text in a .txt file

file=/tmp/textFile.txt
while IFS= read -r line
do
        printf "%s\n" "$line" > /tmp/"$line"txt
done < "$file"

I always get an error saying title too long, is there anyway to shorten the title for the new files to a certain number of characters?