02-08-2013
Use awk to change an IP format
Basically I am trying to run a standard output of IP address with a port number into another command but I need to change it from.
74.125.224.194.80 into 74.125.224.194:80
One command wants a period before the port the subsequent one wants a colon.
So is there anyway I can feed 74.125.224.194.80 into awk and have it just substitute a : in for the 4th period it finds?
I can find all kinds of ways to do global substitutions but I don't need all periods to have a : just the last one.
Thanks in advance!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have about 300 files which has the function getDBBackend().
How to write a program to change the empty function from the old format to the new format?
Old empty function format are either:
function getDBBackend()
{
// Not available
} // getDBBackend
or:
function... (0 Replies)
Discussion started by: powah
0 Replies
2. Shell Programming and Scripting
Hi Everyone,
# cat 1.txt
1321631,77770132976455,19,20091001011859,20091001011907
1321631,77770132976455,19,20091001011859,20091001011907
1321631,77770132976455,19,20091001011859,20091001011907
# cat 1.txt | awk -F, '{OFS=",";print $1,$3,$4,$5}'
1321631,19,20091001011859,20091001011907... (7 Replies)
Discussion started by: jimmy_y
7 Replies
3. Shell Programming and Scripting
Hello,
Can you tell me how can I change this format by awk
Input
0.2057422D-01
0.2463722D-01
-0.1068047D-02
Output
0.02057422
0.02463722
-0.001068047
Thanks
wan (8 Replies)
Discussion started by: wanchem
8 Replies
4. Shell Programming and Scripting
tenxun-glibc_code-x86-64-linux-20120713190049.root.tar.bz2
To
tenxun-glibc_code-x86-64-linux.root.tar.bz2 (3 Replies)
Discussion started by: yanglei_fage
3 Replies
5. Shell Programming and Scripting
Hi,
i have a file input.txt
Continent North America
Country USA Capital Washington D.C.
Country Canada Capital Ottawa
Continent South America
Country Argentina Capital Buenos Aires
Country Brazil Capital Brasília
Coutry Colombia Capital Bogotá
and i want to get an output.txt
... (3 Replies)
Discussion started by: fastlane3000
3 Replies
6. Shell Programming and Scripting
I have below date format in a CSV file. (dd/mm/yyyy)
Ex Input:
9/8/2013
Need to convert it into below format (yyyymmdd ) and redirect to new file.
Ex Output:
20130809
How do I use awk here to change the format and if leading 0 (zero) is not then add it.
Please help. Thanks. (8 Replies)
Discussion started by: vegasluxor
8 Replies
7. UNIX for Dummies Questions & Answers
Greetings!
I need a quick way to change the format in a table of data
Here is an example of the input:
10 72 Value=177 VDB=0.0245 Value4=0,0,171,0
10 274 Value=238 VDB=0.0433 Value4=29,0,205,0
10 312 Value=222 VDB=0.0384 Value4=8,0,190,19
10 540 Value=405 VDB=0.0391 Value4=13,30,153,195... (3 Replies)
Discussion started by: Twinklefingers
3 Replies
8. Shell Programming and Scripting
I have a csv file formatted like this:
2014-08-21 18:06:26,A,B,12345,123,C,1232,26/08/14 18:07and I'm trying to change it to MM/DD/YYYY HH:MM for both occurances.
I have got this:
awk -F, 'NR <=1 {print;next}{"date +%d/%m/%Y\" \"%H:%m -d\""$1 "\""| getline dte;$1=dte}1' OFS="," test.csvThis... (6 Replies)
Discussion started by: say170
6 Replies
9. Shell Programming and Scripting
Example:
Input csv file
00245DLS,Sitel Ocala,12/31/2014,18:45,1.00,7.00,0.00,0.00
00245DLS,Sitel Ocala,12/31/2014,19:00,-1.00,-1.00,-1.00,-1.00
00245HB,Charlotte,01/01/2015,00:00,-1.00,-1.00,-1.00,0.00
Output csv file
00245DLS,Sitel Ocala,2014/12/31,18:45,1.00,7.00,0.00,0.00
00245DLS,Sitel... (8 Replies)
Discussion started by: adit
8 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I have a file where I need to change the date format on the nth field from DD-MM-YYYY to YYYY-MM-DD so I can accurately sort the record by dates
From regex - Use sed or awk to fix date format - Stack Overflow, I found an example using nawk.
Test run as below:
$: cat xyz.txt
A ... (2 Replies)
Discussion started by: newbie_01
2 Replies
LEARN ABOUT DEBIAN
poc-fec
POC-FEC(1) User Command POC-FEC(1)
NAME
poc-fec - send FEC MP3 streams
SYNOPSIS
poc-fec [ -s address ] [ -p port ] [ -t ttl ] [ -q ] [ -k fec_k ] [ -n fec_n ] files...
DESCRIPTION
poc-fec is a streaming server sending mp3 data using a custom FEC protocol. The streamed MP3 frames are first decomposed in autonomous data
units (ADUs). These ADUs are grouped into ADU groups, which are encoded redundantly using a FEC method by Luigi Rizzo. A group of k ADUs is
encoded as n data packets. Any k of these n data packets is sufficient to recover the original k ADUs. It sends the files in the order
given on the command-line. Use the filename - to stream from standard input. Normally, the FEC protocol is used to stream to multicast
groups.
OPTIONS
-s address
Specify the address to send to (default 224.0.1.23).
-p port
Specify the port to send to (default 1500).
-t ttl Specify the TTL parameter to be set on outgoing parameters (default 1).
-q Don't output any information on standard error.
-k fec_k
Specify the number of ADUs that will be encoded as an ADU group (default 20).
-n fec_n
Specify the number of packets that the ADU groups will be encoded to (default 25). This number must be greater than the fec_k param-
eter.
EXAMPLES
poc-fec -s 224.0.1.24 -p 8989 -t 2 -k 16 -n 32 bla.mp3
Send the file bla.mp3 using the RTP RFC fec protocol to the address 224.0.1.24 on port 8989, and set the TTL to 2. MP3 frames of
bla.mp3 are converted to ADUs and grouped in ADU groups of 16 ADUs. These 16 ADUs are encoded into 32 packets and streamed. A client
will have to receive at least 16 packets to recover the original ADUs.
AUTHORS
Manuel Odendahl <manuel@bl0rg.net>, Florian Wesch <dividuum@bl0rg.net>
February 2005 POC-FEC(1)