Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

linux cut all but last field

#I have the next line
#./dir1/d1_copy/d12/f12.txt | 2022 03 10
#to get the last field i have to reverse the line, then cut the first field and reverse again
echo "./dir1/d1_copy/d12/f12.txt | 2022 03 10" | rev | cut -d/ -f1 | rev
#result f12.txt | 2022 03 10

#syntax
#command | rev | cut -d(field separator char.) -f1 | rev
 
PREVIOUS NEXT
Tagged: #linux #cut #field
ADD COMMENT
Topic
Name
1+5 =