The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 06-25-2009
shaliniyadav shaliniyadav is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 30
Hi,

Input is same...

Now that this output is generated need to just delete the occurances..
Considering same output
But output is:
Code:
BCCH 4 0 4 6 9 106 1351 77
BCCH 4 0 4 6 9 106 1352 68
NON_BCCH 4 0 4 6 9 106 1351 87
NON_BCCH 4 0 4 6 9 106 1351 113
NON_BCCH 4 0 4 6 9 106 1352 112
NON_BCCH 4 0 4 6 9 106 1351 122
NON_BCCH 4 0 4 6 9 106 1352 119
NON_BCCH 4 0 4 6 9 106 1352 124
NON_BCCH 4 0 4 6 9 106 1352 756
If you just check 3rd 4th 6th only last values are varrying.... So what i want is in same line it should be appended

Like
Non_BCCH 4 0 4 6 9 106 1351 87 113 122

thats it... Considering the last values in same line...

What i tried was:

By using below input
contents of file.txt:
TCS,1

TCS,2

TCS,3

TCS,4

CTS,1

CTS,2

CTS,3


O/P:
TCS, 1 2 3 4
CTS, 1 2 3

But i am not sure that al values wil be in continuous manner

considering

abc,1
abc,2
xyz,5
abc,4
i am not getting
Below code
awk -F, '
{
if(NR == 1)
printf("%s",$0);
else
{
if($1 != var)
{
printf("\n%s,%d",$1,$2);
}
else
printf(" %s",$2);
}
var = $1;
}' file.txt

Last edited by Yogesh Sawant; 06-29-2009 at 05:51 AM.. Reason: added code tags