![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| get all entries after particular date !! | zedex | Shell Programming and Scripting | 7 | 11-23-2007 04:41 AM |
| separating filename and extension | lucaspewkas | Shell Programming and Scripting | 2 | 04-06-2007 07:07 AM |
| Separating commands/programs with ; | dush_19 | High Level Programming | 2 | 06-22-2006 05:34 AM |
| separating fields | new2ss | Shell Programming and Scripting | 5 | 02-19-2006 09:02 PM |
| separating commands | mile1982 | High Level Programming | 2 | 09-13-2004 11:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
separating entries by using cat command
Hi there,
Is there any option if I cat the following line from a file and than redirect to another as separate entries: unixsrv1:unixsrv2:unixsrv3:mercury:mercury01:sunprd01:sunprd02:hpprod07:ibmprod43 output to file shoudld be: unixsrv1 unixsrv2 unixsrv3 ... and so on. Your help is really appreciated. |
|
||||
|
Input file:-
$ > cat 123.txt unixsrv1:unixsrv2:unixsrv3:mercury:mercury01:sunprd01:sunprd02:hpprod07:ibmprod43 $ > Command:- $ > cat 123.txt | tr -s ":" "\n" > 123_1.txt $ > Output:- $ > cat 123_1.txt unixsrv1 unixsrv2 unixsrv3 mercury mercury01 sunprd01 sunprd02 hpprod07 ibmprod43 $ > Thanks, Karthik. |
|
||||
|
Excellent !! you guys are the best helpers.
A quick ?, how can I get rid of the duplicate entries: This is what I have now; unixsrv1 unixsrv1 . . . unixsrv1 (20 entries) same for the other hosts. I ran the following command but no luck! # cat file | sort | uniq -d Thanks again guys. |
| Sponsored Links | ||
|
|