11-14-2012
Possible.
You could use match for the required regexp and then get the required substring by substr using values of RSTART and RLENGTH and invoke gensub on this substring.
Please post a sample of the input and the desired output for better suggestions.
Last edited by elixir_sinari; 11-14-2012 at 08:28 AM..
This User Gave Thanks to elixir_sinari For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am writing a c++ program that has many calls of pow(input,2). I now realize that this is slowing down the program and these all should be input * input for greater speed.
There should be a simple way of doing this replacement throughout my file with awk, but I am not very familiar with awk.... (2 Replies)
Discussion started by: bluejayek
2 Replies
2. Shell Programming and Scripting
Hi,
I have a file having around 30 records. Each record has 5 fields delimited by PIPE. Few records in the file having Junk characters in the field2 and field4.
I found the junk charcter and I tested it and replace the junk with space with the command below
perl -i -p -e "s/\x00/ /g"... (1 Reply)
Discussion started by: ramkrix
1 Replies
3. Shell Programming and Scripting
Hello, I am using awk to match text in a tab separated field and am able to do so when matching the exact word. My problem is that I would like to match any sequence of text in the tab-separated field without having to match it all. Any help will be appreciated. Please see the code below.
awk... (3 Replies)
Discussion started by: rocket_dog
3 Replies
4. Shell Programming and Scripting
Dear All,
I have file with 4 columns:
1 AA 0 21
2 BB 0 31
3 AA 0 21
4 CC 0 41
I would like to find the duplicate record based on column 2 and replace the 4th column of the duplicate by a new value. So, the output will be:
1 AA 0 21
2 BB 0 31
3 AA 0 -21
4 CC 0 41
Any suggestions... (3 Replies)
Discussion started by: ezhil01
3 Replies
5. Shell Programming and Scripting
I have 2 files A.txt and B.txt
A.txt 3 fields and separate by a comma
some,thing,florida
any1,thing1,california
some2,thing2,dallas
just,fun,kansas
B.txt has 8 fields and separate by a comma
what,ever,florida-state,,,,,,
some,one,dallas_state,,,,,,
You will see 3rd fields are the... (5 Replies)
Discussion started by: sabercats
5 Replies
6. Shell Programming and Scripting
Hello,
I'm trying the solve the following problem.
I have a file which I intend to use as a csv called master.csv
The columns are separated by commas.
I want to change the text on a specific row in either column 3,4,5 or 6 from xxx to yyy depending upon if column 1 matches a specified pattern.... (3 Replies)
Discussion started by: cyphex
3 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I have an input file with below data and rules file to apply search and replace by each field in the input based on exact value or pattern.
Could you please help me with unix script to read input file and rules file and then create the output and reject files based on the rules file.
Input... (13 Replies)
Discussion started by: chandrath
13 Replies
8. Shell Programming and Scripting
Hi there,
First of all this is my first post here. Thank you in advance for your help.
What I am trying to do is the following. I have a text file where each field of each row is separated by a tabulator.
Looks like this:
ATOM 1 N HSE A 26 3.033 -10.429 -2.262 1.00 17.07 ... (8 Replies)
Discussion started by: doom4
8 Replies
9. Shell Programming and Scripting
Hello friends,
I have huge file with many sets where each "set" has few lines and each set always begins with "Set" in Sq brackets as shown above.
# cat file1 (2 Replies)
Discussion started by: magnus29
2 Replies
10. UNIX for Dummies Questions & Answers
Hi All,
Seeking for your assistance on how to search and replace the last field/column. please see sample below:
inputfile1.csv
="8923523434",="543623534"="afd23535623",="100"="200"
="8923523431",="543623536"="afd23535626",="101"="201"... (3 Replies)
Discussion started by: poginiks
3 Replies
LEARN ABOUT MOJAVE
remquol
REMQUO(3) BSD Library Functions Manual REMQUO(3)
NAME
remquo -- floating-point remainder and quotient function
SYNOPSIS
#include <math.h>
double
remquo(double x, double y, int *quo);
long double
remquol(long double x, long double y, int *quo);
float
remquof(float x, float y, int *quo);
DESCRIPTION
The remquo() functions compute the value r such that r = x - n*y, where n is the integer nearest the exact value of x/y.
If there are two integers closest to x/y, n shall be the even one. If r is zero, it is given the same sign as x. This is the same value that
is returned by the remainder() function. remquo() also calculates the lower seven bits of the integral quotient x/y, and gives that value
the same sign as x/y. It stores this signed value in the object pointed to by quo.
SPECIAL VALUES
remquo(x, y, quo) returns a NaN and raises the "invalid" floating-point exception if x is infinite or y is 0.
VECTOR OPERATIONS
If you need to apply the remquo() function to SIMD vectors or arrays, using the following functions provided by the Accelerate.framework may
give significantly better performance:
#include <Accelerate/Accelerate.h>
vFloat vremquo(vFloat x, vFloat y, vUInt32 *q);
SEE ALSO
math(3), remainder(3)
STANDARDS
The remquo() functions conform to ISO/IEC 9899:2011.
BSD
December 11, 2006 BSD