-rw-r----- 1 root system 0 Jun 03 01:50 /etc/name_v1
-rw-r----- 1 root system 0 Jun 03 01:50 /etc/name_v2
-rw-r----- 1 root system 0 Jun 03 01:50 /etc/name_v3
From this, i need find out only '/etc/name_v3' of the last line(last part of the last line). And need to store that value to a variable.
I gave just an eg.
I am not sure about the file content, all i need to do is to find the last part of the last line. I want a general way to find the particular content from the file.
That's slightly different from what you asked originally.
$ cat file1
-rw-r----- 1 root system 0 Jun 03 01:50 /etc/name_v1
-rw-r----- 1 root system 0 Jun 03 01:50 /etc/name_v2
-rw-r----- 1 root system 0 Jun 03 01:50 /etc/name_v3
-rw-r----- 1 root system 0 Jun 03 01:50 /etc/name v4
$ sed -n "$ s|.*/||p" file1
name v4