Hello experts,
I have question that i want to extract the second last word of each line.
I have a text file, in that text file there are near about 40 lines.
sample of line present in file
/user/Oracle/x/x/S/part_bkp/temp_part_bkp/x1/test1
/user/Oracle/x/x/S/part_bkp/temp_part_bkp/x10/testing_x
I want to extract
x1
x10 from each line....
Can any one please help, as i am in learning phase.
awk -F"/" '{print $(NF-1)}' file
Thanks a lot bartus11 for your help...
Can you tell me how could i store the whole path in a variable by excluding the last word
lets say
/user/Oracle/x/x/S/part_bkp/temp_part_bkp/x1/test1
is the complete path then i want to get
/user/Oracle/x/x/S/part_bkp/temp_part_bkp/x1/ in a variable
actually i am trying to archive something which very tough for me as a beginner. here is a small description
Lets say i have a directory A which has some changes made on daily basis
i am storing information of file changed in file by using Find command.
Now i have another copy of directory A as copy_A
Now I want to write a script which read line by line text from file and copy the changes and place it in copy_A
if you have some logic then please share with me
find /usr/oracle/Data/web/catalog/default -mtime -1 -type f > user/oracle/Test_admin/myfolder/bakup/part_bkptemp_part_bkp_repeated/list.txt
while read eachline
do cp -p $eachline "copy of Dirctory Copy_A"
done < user/oracle/Test_admin/myfolder/bakup/part_bkptemp_part_bkp_repeated/list.txt