I'm sorry, but waiting for us to tell you what the format is for your input data seems extremely backwards. You should be able to either show us the format that is used to print the last field in your input file, show us the output for a data sample with a negative imaginary part, or explicitly state that there will NEVER be any negative imaginary parts.
In addition to what RudiC suggested and assuming that if there are any negative imaginary parts in your complex numbers, they use a - instead of a + to separate the real and imaginary parts; you could modify your sed command to cover both cases (assuming you are using a standards conforming sed with an extension that allows multiple substitute commands to be separated on one line by a semicolon [as was used in your code]):
or, if there could be more than one complex number on a line:
If you're using a GNU sed which does not always adhere to the standards, you might need to use:
to make it work. If you would tell us what operating system and shell you're using when you submit questions like this, those of us trying to help you would be able to determine which code suggestion might work for you without making assumptions about what OS you might be using.
This User Gave Thanks to Don Cragun For This Post:
Hi ,
I have file named docs.txt
The content of the file look like this:
DOC disk location Size
======= ===== ============= =========
TXT A /dev/dm-1 10
TXT B /dev/dm-2 10
BIN C ... (3 Replies)
Hi,
Can someone here help sorting the following data in numeric order?
INPUT:
FIRST abc(3) def(13) fgh(1) ijk(6) abc(2)
SECOND dfe(10) abc(4) hij(19) tlm(1) hij(1) hub(10) abc(1) fed(3)
OTHERS hij(10) mok(4) bub(19) hij(1) abc(2) abc(15) abc(1) hij(3)
OUTPUT:
FIRST def(13) ijk(6)... (12 Replies)
Hi, I'm working on gathering information stored in .txt files. The format of the data within the .txt files is shown in the picture uploaded with this post. Sections like the one pictured are repeated (with different data, same format) many times within each .txt file but each section is of data... (4 Replies)
Hi,
I have a file look likes this :
--->start hir
Trace file: pudwh_ora_9998.trc
Sort options: fchela exeela
***************************************************************count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed... (3 Replies)
picked this up from another thread.
echo 1st_file.csv; nawk -F, 'NR==FNR{a++;next} a{b++}
END{for(i in b){if(b-1&&a!=b){print i";\t\t"b}else{print "NEW:"i";\t\t"b} } }' OFS=, 1st_file.csv *.csv | sort -r
i need to use the above but with a slight modification..
1.compare against 3 month... (25 Replies)
I have bash, awk, and sed available on my portable device. I need to extract 10 fields from each table row from a web page that looks like this:
</tr>
<tr>
<td>28 Apr</td>
<td><a... (6 Replies)
Hi,
I have a file. In this file when ever the word "ABC" occurs at position from 25 and 34 I would like to replace
the value at postion 100 to 5 for the first 1000 rows only.
I have written the following Awk command.
nawk 'substr($0,25,9)=="ABC" {print $0}' filename
The above command... (4 Replies)
hello,
i have a complex awk problem...
i have two tables, one with a value (0 to 1) and it's corresponding p-value, like this:
1. table:
______________________________
value p-value
... ...
0.254 0.003
0.245 0.005
0.233 0.006
... ...
______________________________
and a... (6 Replies)
Hello experts,
Shown below is the 2 column sample data(there are many data columns in actual input file),
Key, Data
A, 1
A, 2
A, 2
A, 3
A, 1
A, 1
A, 1
I need the below output.
Key, Data
A, 2
A, 2
A, 3
A, 1
A, 1
A, 1 (2 Replies)
Hy!
I need to post-process some data files which have variable (and periodic) number of fields. For example, I need to square (data -> data*data) the folowing data file: -5.34281E-28 -3.69822E-29 8.19128E-29 9.55444E-29 8.16494E-29 6.23125E-29
4.42106E-29 2.94592E-29 1.84841E-29 ... (5 Replies)
Discussion started by: radudownload
5 Replies
LEARN ABOUT X11R4
csqrt
CSQRT(3) Linux Programmer's Manual CSQRT(3)NAME
csqrt, csqrtf, csqrtl - complex square root
SYNOPSIS
#include <complex.h>
double complex csqrt(double complex z);
float complex csqrtf(float complex z);
long double complex csqrtl(long double complex z);
Link with -lm.
DESCRIPTION
These functions calculate the complex square root of z, with a branch cut along the negative real axis. (That means that csqrt(-1+eps*I)
will be close to I while csqrt(-1-eps*I) will be close to -I, if eps is a small positive real number.)
VERSIONS
These functions first appeared in glibc in version 2.1.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+----------------------------+---------------+---------+
|Interface | Attribute | Value |
+----------------------------+---------------+---------+
|csqrt(), csqrtf(), csqrtl() | Thread safety | MT-Safe |
+----------------------------+---------------+---------+
CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
SEE ALSO cabs(3), cexp(3), complex(7)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
2017-09-15 CSQRT(3)