The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: awk on a string
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 07-24-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,926
Actually,
it could be easily done in shell without any external command
(unless, as already stated, there is another reason to use AWK in this particular case):


Code:
% s=a:b:c
% (IFS=:;set -- $s;printf "$3\n")
c

With Z-Shell:

Code:
zsh-4.3.4% print ${${(s.:.)s}[3]}
c