Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

awk output field separator

Just use function split in awk command to split a line into an array 'a'
using a choosen string as delimiter as for example ", " in next use case:
echo "hi, bye, hey" | awk '{split($0,a,", "); print a[3],a[2],a[1]}'
Comment

awk use string as field separator

Just use function split in awk command to split a line into an array 'a'
using a choosen string as delimiter as for example ", " in next use case:
echo "hi, bye, hey" | awk '{split($0,a,", "); print a[3],a[2],a[1]}'
Or you could also do next:
echo "a, b, c" | sed 's/, /,/g' file.txt | awk -F ',' '{print $1 $2 $3}'
Comment

PREVIOUS NEXT
Code Example
Shell :: sudo apt install 
Shell :: git list untracked files 
Shell :: npm i postgresql 
Shell :: copy from server to local ssh 
Shell :: concatenate strings bash 
Shell :: git push to create 
Shell :: comment in bash 
Shell :: how to get first in jq 
Shell :: chown a file 
Shell :: Git - create new branch and switch to that new branch 
Shell :: git logline 
Shell :: how to get all branches from gitlab repository 
Shell :: create new github repo 
Shell :: env file in firebase 
Shell :: chmod chown 
Shell :: how to install npm packages globally 
Shell :: assign permission to files and folder ubuntu separate 
Shell :: git merge branch into another branch 
Shell :: How to create and extract an archive or .tar file using linux commands 
Shell :: duplicate wsl distro 
Shell :: force-logout user linux 
Shell :: copy files from windows to wsl2 ubuntu 
Shell :: install nvm mac 
Shell :: nginx on ubuntu 
Shell :: ajouter tag github 
Shell :: uninstalling vscode for centos 8 
Shell :: linux apt ignore not found package 
Shell :: Target DEP-11-icons-small (stable/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-groovy.list:1 and /etc/apt/sources.list.d/docker-ce.list:1 
Shell :: ufw enable no disturb 
Shell :: how to add geth to environment variables 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =