Hi,
I have a file, say files_list, as below (o/p of ls -R cmd)
$ cat files_list
/remote/dir/path/to/file:
sub-dir1
sub-dir2
sub-dir3
...
/remote/dir/path/to/file/sub-dir1:
remote_file1.csv.tgz
<blank line 1>
/remote/dir/path/to/file/sub-dir2:
remote_file2.csv.tgz
<blank line 2>
/remote/dir/path/to/file/sub-dir3:
remote_file3.csv.tgz
<blank line 3>
....
I want to read this file in a loop and produce an o/p like
Output file
-----------
/remote/dir/path/to/file/sub-dir1/remote_file1.csv.tgz
/remote/dir/path/to/file/sub-dir2/remote_file2.csv.tgz
/remote/dir/path/to/file/sub-dir3/remote_file3.csv.tgz
.....
I was able to extract all sub-dir in a file, say sub_dir_file
$ cat sub_dir_file
sub-dir1
sub-dir2
sub-dir3
I thought of looping through the list of sub-dir and using below sed between
for line in cat sub_dir_file
do
sed -n '/remote/dir/path/$line, <blank line of this block i.e. blank line1>/p' files_list
.........more formatting..........
done
Am I on the right path or can you please correct the sed /from/,/to pattern/p command?
-dips