Sponsored Content
Top Forums Shell Programming and Scripting Convertin IP adresses from a column to a raw + add a comma between addresses Post 302690029 by oliv66 on Wednesday 22nd of August 2012 11:18:20 AM
Old 08-22-2012
Converting IP adresses from a column to a raw + add a comma between addresses

Hi all,

I have a list of IP addresses in a column in a text file name ipaddress.txt
Code:
192.168.0.1
192.168.0.2
192.168.0.5
192.168.0.4
192.168.0.5

I would like to convert ipaddress.txt to have the following thing :
Code:
192.168.0.1, 192.168.0.2, 192.168.0.3,192.168.0.4,192.168.0.5

I know how to do it with a spreadsheet but it would very useful for me to be able to do it in CLI.

I think I should use sed and awk commands but I haven't find a solution up to now

Your help will be very appreciated.

Regards,

Olivier

Moderator's Comments:
Mod Comment Please view this code tag video for how to use code tags when posting code and data.

Last edited by oliv66; 08-22-2012 at 04:30 PM..
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

convertin in to upper case

write a shell script that accepts one or more file name as arguments and converts all of them to uppercase,provided they exist in the current directory:b::b::b: (2 Replies)
Discussion started by: shawz
2 Replies

2. Shell Programming and Scripting

subtitute value of certain raw and column with sed

Dear All, For example the content of data.txt file is: 1 1 23 2 1 42 3 2 52 4 2 62 5 1 77 6 1 88 7 2 99 8 1 100 Could I substitute 2 in second column with 1 using sed commad so that the data will be change as follow ? 1 1 23 2 1 42 ... (1 Reply)
Discussion started by: ariesto
1 Replies

3. Shell Programming and Scripting

rearrange the column names with comma as column delimiter

Hi, I am new to shell scripting, i have requirement can any one help me out in this regrads, in directory i have file like invoice1.txt, invoice2.txt in each file i have fixed number of columns, 62 in number but they are randomly arranged.like for first file invoice1.txt can have columns... (5 Replies)
Discussion started by: madhav62
5 Replies

4. Shell Programming and Scripting

Replace pipe <|> with comma <,> in a column

Hi All Gurus, I need to replace a pipe <|> with a comma <,> in a few columns with pipe delimited file. The column name are fixed for the replacement of comma <,>. For below example, Col3, Col6 and Col8 are columns need to replace with comma <,> if any pipe encountered. example:... (14 Replies)
Discussion started by: agathaeleanor
14 Replies

5. Shell Programming and Scripting

Substituting comma "," for dot "." in a specific column when comma"," is a delimiter

Hi, I'm dealing with an issue and losing a lot of hours figuring out how i would solve this. I have an input file which looks like this: ('BLABLA +200-GRS','Serviço ','TarifaçãoServiço','wap.bla.us.0000000121',2985,0,55,' de conversão em escada','Dia','Domingos') ('BLABLA +200-GRR','Serviço... (6 Replies)
Discussion started by: poliver
6 Replies

6. Shell Programming and Scripting

Insert comma in place of column

Hi all, I have a file in which I have to insert commna between entries of 2 column and createa new file separated by commas not a columns if input is FHIT Adenosine Monotungstate Not Available CS Trifluoroacetonyl Coenzyme A Not Available Theo expected output is ... (5 Replies)
Discussion started by: manigrover
5 Replies

7. Shell Programming and Scripting

How to use regex on particular column (Removing comma from particular column)?

Hi, I have pipe separated file which contains some data having comma(,) in it. I want to remove the comma(,) only from particular column without changing data in other columns. Below is the sample data file, I want to remove the comma(,) only from 5th column. $ cat file1 ABC | DEF, HIJ|... (6 Replies)
Discussion started by: Prathmesh
6 Replies

8. Shell Programming and Scripting

Bring values in the second column into single line (comma sep) for uniq value in the first column

I want to bring values in the second column into single line for uniq value in the first column. My input jvm01, Web 2.0 Feature Pack Library jvm01, IBM WebSphere JAX-RS jvm01, Custom01 Shared Library jvm02, Web 2.0 Feature Pack Library jvm02, IBM WebSphere JAX-RS jvm03, Web 2.0 Feature... (10 Replies)
Discussion started by: kchinnam
10 Replies
PRIPS(1)						    BSD General Commands Manual 						  PRIPS(1)

NAME
prips -- print the IP addresses in a given range SYNOPSIS
prips [-c] [-d delim] [-e exclude] [-f format] [-i incr] start end prips [-c] [-d delim] [-e exclude] [-f format] [-i incr] CIDR-block prips -h DESCRIPTION
The prips tool can be used to print all of the IP addresses in a given range. It can enhance tools that only work on one host at a time, e.g. whois(1). The prips tool accepts the following command-line options: -c Print the range in CIDR notation. -d delim Set the delimiter to the character with ASCII code delim where 0 <= delim <= 255. -e <x.x.x,x.x> Exclude ranges from the output. -f format Set the format of addresses (hex, dec, or dot). -h Show summary of options. -i incr Set the increment to 'x'. ENVIRONMENT
The prips tool's operation is not influenced by any environment variables. FILES
The prips tool's operation is not influenced by any files. EXAMPLES
Display all the addresses in a reserved subnet: prips 192.168.32.0 192.168.32.255 The same, using CIDR notation: prips 192.168.32/24 Display only the usable addresses in a class A reserved subnet using a space instead of a newline for a delimiter: prips -d 32 10.0.0.1 10.255.255.255 Display every fourth address in a weird block: prips -i 4 192.168.32.7 192.168.33.5 Determine the smallest CIDR block containing two addresses: prips -c 192.168.32.5 192.168.32.11 DIAGNOSTICS
The prips utility exits 0 on success, and >0 if an error occurs. SEE ALSO
ipsc(1), gipsc(1) STANDARDS
No standards were harmed in the writing of the prips tool. HISTORY
The prips tool was originally written by Daniel Kelly and later adopted by Peter Pentchev. This manual page was originally written by Juan Alvarez for the Debian GNU/Linux system and later added to the prips distribution and converted to mdoc format by Peter Pentchev. AUTHORS
Daniel Kelly <dan@vertekcorp.com> Juan Alvarez <jalvarez@fluidsignal.com> Peter Pentchev <roam@ringlet.net> BUGS
Please report any bugs in the prips tool to its current maintainer, Peter Pentchev. BSD
March 1, 2011 BSD
All times are GMT -4. The time now is 07:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy