Prev: While loop in tcsh
Next: percent encoding end decoding
From: Hongyi Zhao on 22 Jan 2010 05:18 Hi all, I've file which including some IP addresses one per line like this: 213.178.224.174 83.201.240.86 85.178.218.16 90.194.80.153 90.48.82.189 93.146.181.125 I want to obtain single line output based on this file with the comma as the delimiter, e.g., like the following: 213.178.224.174,83.201.240.86,85.178.218.16,90.194.80.153,90.48.82.189,93.146.181.125 Any hints on this? Best regards. -- ..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
From: Janis Papanagnou on 22 Jan 2010 05:36 Hongyi Zhao wrote: > Hi all, > > I've file which including some IP addresses one per line like this: > > 213.178.224.174 > 83.201.240.86 > 85.178.218.16 > 90.194.80.153 > 90.48.82.189 > 93.146.181.125 > > I want to obtain single line output based on this file with the comma > as the delimiter, e.g., like the following: > > 213.178.224.174,83.201.240.86,85.178.218.16,90.194.80.153,90.48.82.189,93.146.181.125 > Any hints on this? Maybe something like this... awk '{x=x","$0} END{print substr(x,2)}' yourfile Janis > > Best regards.
From: Radoulov, Dimitre on 22 Jan 2010 05:46 On 22/01/2010 11.18, Hongyi Zhao wrote: [...] > I've file which including some IP addresses one per line like this: > > 213.178.224.174 > 83.201.240.86 > 85.178.218.16 > 90.194.80.153 > 90.48.82.189 > 93.146.181.125 > > I want to obtain single line output based on this file with the comma > as the delimiter, e.g., like the following: > > 213.178.224.174,83.201.240.86,85.178.218.16,90.194.80.153,90.48.82.189,93.146.181.125 > Any hints on this? paste -sd, infile Regards Dimitre
From: Hongyi Zhao on 22 Jan 2010 22:08 On Fri, 22 Jan 2010 11:36:52 +0100, Janis Papanagnou <janis_papanagnou(a)hotmail.com> wrote: >awk '{x=x","$0} END{print substr(x,2)}' yourfile Good, thanks a lot. It does the trick. -- ..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
From: Hongyi Zhao on 22 Jan 2010 22:08 On Fri, 22 Jan 2010 11:46:09 +0100, "Radoulov, Dimitre" <cichomitiko(a)gmail.com> wrote: >paste -sd, infile Good, thanks a lot. It does the trick. -- ..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
|
Pages: 1 Prev: While loop in tcsh Next: percent encoding end decoding |