How would one go about taking all the
*.txt files in a given folder (users input) and copying odd lines to files with identical names but different extension (bat/html or anything else)
mv wont work, something like
sed should do the trick for lines, but im having a hard time incorporating everything together.
If anyone could help me piece this together I would be very thankful
#!/bin/bash clear #seems like a good idea to get a full path to the directory im gonna be working in, not #sure how to go about it though. path=pwd #getting users input read Directory #check if said directory exists if[ -d $Directory]; then #if it does #all files with .txt extention are to be copied for *.txt in $(ls) do mv *.txt *.bat #aaand now im lost, didnt have a chance to even test this, since i have linux only in #my studying enviroment (uni), will get on my personal PC later on #something like sed could/should work in there, but i have no idea how to go about it #if doesnt else echo "Directory does not exist or you do not have a permission to alter its contents"