New to Linux and trying to avoid this in a complicated way. I have a file ("output.txt") that contains the results of the Find command. An example of the first three lines of "output.txt":
/home/user/temp/LT50150292009260GNC01/L5015029_02920090917_MTL.txt
/home/user/temp/LT50150292009276GNC01/L5015029_02920091003_MTL.txt
/home/user/temp/LT50150292009292GNC01/L5015029_02920091019_MTL.txt
I would like to use awk or sed (or the like) to extract two parts from the path specified for each line and output to a new file ("run.txt") with additional information added on each line, for example
cd /home/user/temp/LT50150292009260GNC01; $RUNLD L5015029_02920090917_MTL.txt
cd /home/user/temp/LT50150292009276GNC01; $RUNLD L5015029_02920091003_MTL.txt
cd /home/user/temp/LT50150292009292GNC01; $RUNLD L5015029_02920091019_MTL.txt
I suppose this might also include something like “cut,” but I can't get my head to wrap myself around how to account for changes to the names of folders and files.
Any help would be greatly appreciated.
source
share