Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

shell print all but last field using rev and cut

cat youFile | rev |cut -d "." -f 2- | rev
Comment

PREVIOUS NEXT
Code Example
Shell :: ububto api 
Shell :: error: server terminated early with status 127 
Shell :: what is force checkout in git 
Shell :: add cls as clear to bash 
Shell :: how to install "adguard home" using snap store cli 
Shell :: Color "normal" not understood 
Shell :: instalar arquivo .jar linux 
Shell :: move file force replace linux 
Shell :: npm nix 
Shell :: convert powershell function to c# 
Shell :: git The requested URL returned error: 403 
Shell :: Revert Unstaged and Staged Changes in git command 
Shell :: go to commit remote 
Shell :: git remove before commit 
Shell :: Multiple Sequential Commands in CRON Linux 
Shell :: Install the cordova module using npm utility of Node.js in windows 
Shell :: ex: "push a new local repository to github" 
Shell :: conda install arrow 
Shell :: install exercism 
Shell :: Remove all local GitHub users 
Shell :: check elasticsearch connection status on aws 
Shell :: save vscode account details linux 
Shell :: brew install shopify-cli Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)! 
Shell :: atom required packages for Ubuntu 
Shell :: Using sed to find and replace complex string (preferrably with regex) 
Shell :: cmd create fgile 
Shell :: windows command count output lines 
Shell :: windows powershell the operation requires elevation 
Shell :: httpd package not found 
Shell :: bash search in binary file 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =