Hello, this is my first post
First i would like to thank you all for answering other people questions because I've been able to learn from the forum a lot.
I need your help with something.
I have standard output from 'ls -laR /etc' command which looks like this:
Code:
/etc/X11/xorg.conf.d:
total 4
drwxr-xr-x. 2 root root 29 Apr 1 00:46 .
drwxr-xr-x. 5 root root 54 Apr 1 00:43 ..
-rw-r--r--. 1 root root 232 Apr 1 00:46 00-keyboard.conf
/etc/xdg:
total 12
drwxr-xr-x. 4 root root 36 Apr 1 00:43 .
drwxr-xr-x. 87 root root 8192 Apr 12 13:53 ..
drwxr-xr-x. 2 root root 6 Jun 10 2014 autostart
drwxr-xr-x. 2 root root 17 Apr 7 01:25 systemd
by using sed command:
Code:
sed -e '/./!d' -e '/^total/d' -e '/\.$/d' -e 's/:$/\//' list.txt
I have transformed it to the following form:
Code:
/etc/X11/xorg.conf.d/
-rw-r--r--. 1 root root 232 Apr 1 00:46 00-keyboard.conf
/etc/xdg/
drwxr-xr-x. 2 root root 6 Jun 10 2014 autostart
drwxr-xr-x. 2 root root 17 Apr 7 01:25 systemd
and now I would like to achieve absolute paths at the end of each row
Code:
-rw-r--r--. 1 root root 232 Apr 1 00:46 /etc/X11/xorg.conf.d/00-keyboard.conf
drwxr-xr-x. 2 root root 6 Jun 10 2014 /etc/xdg/autostart
drwxr-xr-x. 2 root root 17 Apr 7 01:25 /etc/xdg/systemd
How do I join(merge) filenames with corresponding absolute path to their parent directory?
I know how to extract filenames using awk and get this:
Code:
00-keyboard.conf
autostart
systemd
but I don't know what to do next. Should I use some hitech sed option or go for loop or try with arrays? Help. Heeeelp