2
A new need arose accompanied by a good and new question that until then did not find anything similar on the internet - Copy a single line at a time to a different single file.
Example for each new line to be copied:
total=10
linha=`cat Arquivo_de_origem`
for i in `seq $total`
echo "$linha" > /home/$USER/$i
done
The source file contains more than 10 lines, but I only need to get ten, so I limit the variable total=10
That will make the for
traverse 10x determined by seq
, interacting about i
The echo
followed by the variable linha
line-by-line
Dai destination files are being created in ordinal numbers - 1 2 3 4 5 6 7 8 9 ...
Then we’d have to copy first line to first file, copy second line to second file and so on.
Concluding - make a copy of a name for a single file.
I know I’ll have to wear one increment and tals, but I don’t know how.
Barbadinha, I will write the script and then put it here for you. These the contents of these lines have space between the words? Give me an example of line.
– Alessandro Schneider