05-17-2007
Help Replacing Characters in Flat File
I was wondering if somebody could help me with something on UNIX. I have a file that looks like this -
"nelson,bill","bill","123 Main St","Mpls","MN",55444,8877,william
I want to replace all comma with pipes (|), except if the comma is within double quotes. (The first field is an example of this.) I can't do do a sed looking for "," and replacing that with a pipe because not all fields have double quotes around them. Side note - I do not have access to Perl, so that's not an option.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
I have huge xml file. The file contains some comment tags . I have requirement to replace comment tag with another comment tag.
Say for example : file X has -- Part of the file
<?xml version="1.0" encoding="ISO-2"?><translationResults jobDate="20070123 23:20:51"... (1 Reply)
Discussion started by: purnakarthik
1 Replies
2. UNIX for Dummies Questions & Answers
hi
i want to replace the characters between positions 2 to 30 in each line in a file
how to do it
suggestions welcome (2 Replies)
Discussion started by: trichyselva
2 Replies
3. UNIX for Dummies Questions & Answers
Hello all,
This is my first post here, so please excuse me if this question is too obvious or has been asked before. I am new to Unix and although I tried to search your forum for the answer to my question, I could not find an answer that would help me.
I have a 500MB csv file with numeric values... (1 Reply)
Discussion started by: finwhiz
1 Replies
4. UNIX for Advanced & Expert Users
Hey,
Is there anyway I anks,
Pocha (12 Replies)
Discussion started by: pochaman
12 Replies
5. Shell Programming and Scripting
Hi
I have the fixed width flat file having the following data
12345aaaaaaaaaabbbbbbbbbb
12365sssssssssscccccccccc
12365sssss
12367ddddddddddvvvvvvvvvv
12367 vvvvv
Here the first column is length 5 second is length 10 third is length 10
if the second or third column exceeds... (3 Replies)
Discussion started by: Brado
3 Replies
6. AIX
hello everybody
i am looking for a shell to cut a flat file (with a long unique line) according to a certain number of characters and redirect every result to an output file.
here is an example
MyFile :
12 3 456 12 3 456 12 3 456 .....
and i took every 9-characters including BLANKS... (6 Replies)
Discussion started by: fastlane3000
6 Replies
7. UNIX for Dummies Questions & Answers
HI,
can any one help me please ..
i have flat file like
qwer123rt ass3242ccf jjk654
kjh838ppp nhdg453ok hdkk34
i want remove numeric characters in the flat file
i want output like this
qwerrt assccf jjk
kjhppp nhdgok hdkk
help me... (4 Replies)
Discussion started by: rafimd1985
4 Replies
8. Shell Programming and Scripting
Hi....I need one help....
I'm having a files which is having the data as follows...
a
b
c c
d d d
e
f
Now I need to find out distinct characters from this file and the output should be as follows -
a
b
c
d
e
f
Can you please help me on this? I'm using KSH script. (18 Replies)
Discussion started by: Krishanu Saha
18 Replies
9. Shell Programming and Scripting
Greetings all
I have a delimited text file (the delimiter is ';') where certain fields consist of many blanks e.g. ; ; and ; ;
Before I separate the data I need to eliminate these blanks altogether.
I tried the sed command using the following syntax:
sed -i 's/; *;/;;/g' <filename>
... (15 Replies)
Discussion started by: S. BASU
15 Replies
10. UNIX for Advanced & Expert Users
Suppose I have a file which has 1000 columns (5 SHOWN FOR EXAMPLE)
two alphabets are separated by a space and then tab
A A"\t"C C"\t"G G"\t"0 0"\t"T T
A G"\t"C C"\t"G G"\t"A T"\t"0 0
G A"\t"0 0"\t"G C"\t"A A"\t"T C
whenever there is a 0 0 in any column, the output should be printed as
A... (12 Replies)
Discussion started by: rossi
12 Replies
fmax(3M) Mathematical Library Functions fmax(3M)
NAME
fmax, fmaxf, fmaxl - determine maximum numeric value of two floating-point numbers
SYNOPSIS
cc [ flag... ] file... -lm [ library... ]
#include <math.h>
double fmax(double x, double y);
float fmaxf(float x, float y);
long double fmaxl(long double x, long double y);
DESCRIPTION
These functions determine the maximum numeric value of their arguments. NaN arguments are treated as missing data: if one argument is a NaN
and the other numeric, these functions choose the numeric value.
RETURN VALUES
Upon successful completion, these functions return the maximum numeric value of their arguments.
If just one argument is a NaN, the other argument is returned.
If x and y are NaN, a NaN is returned.
ERRORS
No errors are defined.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
fdim(3M), fmin(3M), math.h(3HEAD), attributes(5), standards(5)
SunOS 5.10 1 Sep 2002 fmax(3M)