05-15-2013
Are there any characters in you input other than colon, comma, period, open and close parentheses, and digits?
Nope, just digits, colons, commas, and parentheses
Is this a line in a file or is it the value stored in a shell variable? If it is in a file, will there be more than one line?
The lines are in a text file. Files have between 1 and 1000 lines
What OS are you using?
Mac OSX
Is the letter you want to add always a uppercase A?
No. I could add any letter, upper or lower case.
Will the parentheses always be arranged the same way?
Yes
Will there always be 3 numbers you want to keep and 1 colon after each number you want to keep?
I want to delete the four digits and decimal point after the colon and retain the digits before the colon. The number after the colon is always x.xxx and the number before the colon is either one digit or two but never three
I thought I could do something like this: awk \:\d\.\d+ file > file_b for the first task at least, but have not been successful. Thank you for your help!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
The log reads as follows.
fname1;lname1;eid1;addr;pincode1;
fname2;lname2;eid2;addr2;pincode2;
fname3;lname3;eid3;addr3;pincode3;
fname4;lname4;eid;addr4;pincode4;
how do i extract only fname and save it in an array
similarly for lname and so on
i tried reading a file and cutting each... (5 Replies)
Discussion started by: vkca
5 Replies
2. UNIX for Dummies Questions & Answers
So, I'd like to wget a webpage, as its not going to stick around forever - but the problem is the webpage has a semicolon in it.
wget http://example.com/stuff/asdf;asdf obviously doesn't get the right webpage.
Any good way around this? (2 Replies)
Discussion started by: Julolidine
2 Replies
3. Shell Programming and Scripting
I have a file that is formatted in this way.
a1;b2;c33;d4;e5;e;f;f;f;s
d;ds;d;a;v;b;g;gr;r;rt;fdf
s1;s2;s2;s3;s4;
b1;f2;g3;h4;a3c4e;xcsd;fds;
sd2;fs4;fs2;sdf3;
I want to replace the value just before the 4th semicolon to empty string, regardless the value, such that it looks... (3 Replies)
Discussion started by: alienated
3 Replies
4. Shell Programming and Scripting
char str; char str ;
char *ptr; char * ptr;
int CASE; int CASE;
double temp; double temp;
Output should be:
char str;
char *ptr;
int CASE;
double temp;
How can i do this with awk,sed,perl? (5 Replies)
Discussion started by: cola
5 Replies
5. Shell Programming and Scripting
Hi guys,
I want to write script so that i can put semicolon after every numeric
e.g
input would be like that
50060E80058F49A4
Output should be
50:06:0E:80:05:8F:49:A4
Please help
Thanks & Regards
Nirjhar (11 Replies)
Discussion started by: nirjhar17
11 Replies
6. Shell Programming and Scripting
Hi,
I have a file in PERL in the following pattern
filename| 06-Dec-11 03.04.14.000000 PM
filename1| 06-Dec-11 05.05.14.000000 PM
I need to replace .(dot) with :(semicolon) in the timestamp value of the file
How can this be done. Any help will be appreciated
Thanks in advance (5 Replies)
Discussion started by: irudayaraj
5 Replies
7. Shell Programming and Scripting
Hi,
I have a script which I need to change. I want to add a semicolon at the end of each line where the line starts with "grant"
for e.g.
create table(....
);
grant select on TABL1 to USER1
grant select on TABL1 to USER2should become
create table(....
);
grant select on TABL1 to... (3 Replies)
Discussion started by: pparthiv
3 Replies
8. Shell Programming and Scripting
Hi,
I wanted to create an automated script that will output a create table statement in unix. Below is the input and the desired output:
INPUT:
desc ZZ_APL_TIDDATELIST
(
TID NUMBER
AEX_DATE TIMESTAMP(6)
)
desc ZZ_APL_TIDLIST
(
TID NUMBER
)
desc... (5 Replies)
Discussion started by: reignangel2003
5 Replies
9. Shell Programming and Scripting
Dear folks
Hello
I have a data set which one of the column of this data set are string and I want to extract numbers which is between two ":". However, I know the substr command which will do this operation but my problem is the numbers between two ":" have different digits. this will make my... (11 Replies)
Discussion started by: sajmar
11 Replies
10. Shell Programming and Scripting
Hello Team,
Could you please help me with the below question?
I have a file with the following properties
1) File Delimiter is ;
2) Text columns are within double quotes
3) Numeric columns will not have double quotes
4) File has total 6 columns
Please see a sample record from file
... (3 Replies)
Discussion started by: sam99
3 Replies
IPX(3) BSD Library Functions Manual IPX(3)
NAME
ipx_addr, ipx_ntoa -- IPX address conversion routines
LIBRARY
IPX Address Conversion Support Library (libipx, -lipx)
SYNOPSIS
#include <sys/types.h>
#include <netipx/ipx.h>
struct ipx_addr
ipx_addr(const char *cp);
char *
ipx_ntoa(struct ipx_addr ipx);
DESCRIPTION
The routine ipx_addr() interprets character strings representing IPX addresses, returning binary information suitable for use in system
calls. The routine ipx_ntoa() takes IPX addresses and returns ASCII strings representing the address in a notation in common use:
<network number>.<host number>.<port number>
Trailing zero fields are suppressed, and each number is printed in hexadecimal, in a format suitable for input to ipx_addr(). Any fields
lacking super-decimal digits will have a trailing 'H' appended.
An effort has been made to ensure that ipx_addr() be compatible with most formats in common use. It will first separate an address into 1 to
3 fields using a single delimiter chosen from period '.', colon ':' or pound-sign '#'. Each field is then examined for byte separators
(colon or period). If there are byte separators, each subfield separated is taken to be a small hexadecimal number, and the entirety is
taken as a network-byte-ordered quantity to be zero extended in the high-network-order bytes. Next, the field is inspected for hyphens, in
which case the field is assumed to be a number in decimal notation with hyphens separating the millennia. Next, the field is assumed to be a
number: It is interpreted as hexadecimal if there is a leading '0x' (as in C), a trailing 'H' (as in Mesa), or there are any super-decimal
digits present. It is interpreted as octal if there is a leading '0' and there are no super-octal digits. Otherwise, it is converted as a
decimal number.
RETURN VALUES
None. (See BUGS.)
SEE ALSO
hosts(5), networks(5)
HISTORY
The precursor ns_addr() and ns_toa() functions appeared in 4.3BSD.
BUGS
The string returned by ipx_ntoa() resides in a static memory area. The function ipx_addr() should diagnose improperly formed input, and
there should be an unambiguous way to recognize this.
BSD
June 4, 1993 BSD