![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accessing variables of one shell script in another shell script | rsendhilmani | Shell Programming and Scripting | 2 | 03-17-2009 01:17 AM |
| invoking a shell script inside cgi shell script | smriti_shridhar | Shell Programming and Scripting | 2 | 07-09-2008 02:50 AM |
| Accessing variables of one shell script in another shell script | looza | Shell Programming and Scripting | 2 | 06-30-2008 08:13 PM |
| How to pass a parameter from one Shell-script to another Shell-script | subodhbansal | Shell Programming and Scripting | 2 | 09-22-2007 06:19 AM |
| Have a shell script call another shell script and exit | heprox | Shell Programming and Scripting | 2 | 11-20-2006 08:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hey ..
here is a sample and i would like to sort it to order it to be username then the,shell, after that home directory rootbash:x:0:1:0000-Admin(0000):/:/usr/local/bin/bash rootnt:x:0:1:0000-Admin(0000):/:/usr/local/bin/bash daemon:x:1:1:0000-Admin(0000):/:/usr/local/bin/bash nobody:x:60001:60001:uid no body:/:/usr/local/bin/bash noaccess:x:60002:60002:uid no access:/:/usr/local/bin/bash thank you ... |
|
||||
|
shell script by sed
I would prefer awk for this: Code:
awk -F ':' '{printf("%s:%s:%s\n", $1, $7, $6)}' datafile.txt
but sed could work too: Code:
sed 's/^\([^:]*\):[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):\([^:]*\)/\1:\3:\2/g' datafile.txt |
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|