Search Results

Search: Posts Made By: f_o_555
2,674
Posted By f_o_555
Print all lines in a row except the last one with awk
Hi again,
is it possible to do the following using awk?

input file is
4.465E+17
5.423E+16
1.218E+17
2.600E+16
9.135E+15
1.238E+14
...
6.238E+14
desired output
4.465E+17 &
5.423E+16 &...
962
Posted By f_o_555
Yes, thanks
Yes, thanks
962
Posted By f_o_555
Hi, thank you. it almost what I need. In the...
Hi,
thank you. it almost what I need.
In the very last row there should be the second column entry of the last row of the input.
the output should end as

9.00E-01 A
1.00E+00
962
Posted By f_o_555
Adding character and append last element of second column
Hi,
could you help me in processing this file under bash?
I need to add some text to the first line and then append the last element of the second columns.
The input file is tab separated while...
1,318
Posted By f_o_555
awk? I had something like awk -F'\t' ' ...
awk?

I had something like

awk -F'\t' '
(/^[0-9]/ && $1 = sprintf("%.4E", $2 + $3 + $4)) || -3
' OFS='\t' file

but I think this was working for rows....as far as I recall
1,318
Posted By f_o_555
Sum column content
Hi,
in bash I have a text file like this.

text1 1.365E+08 1.363E+08 1.354E+08 1.314E+08 1.207E+08 8.964E+07 3.830E+07
text1 7.139E+08 7.131E+08 7.081E+08 6.875E+08 6.315E+08 4.689E+08 2.003E+08...
1,118
Posted By f_o_555
Add spaces to variable
Hi,
I'm passing a variable to a scrpit which can be 1 to 3 characters long.
How can I force it to be three character long and add spaces to it?

The passed variable is stored in $1 and I would...
955
Posted By f_o_555
Let's say that I want to change the character in...
Let's say that I want to change the character in row 3, column 15 to X

Input
#-----------------------------------
3 ! number of parameters of the polynome
0.00000e+00 0 !...
955
Posted By f_o_555
is there a way to specify the row number? I would...
is there a way to specify the row number? I would like to change only one row+column
955
Posted By f_o_555
Change the i-th character of the j-th line
Hi,
I have a file like


#-----------------------------------
3 ! number of parameters of the polynome
0.00000e+00 0 ! fix=0) free=1
1.03916e-03 1 ! fix=0) free=1 ...
1,497
Posted By f_o_555
It seems to work now...I'll keep an eye and see...
It seems to work now...I'll keep an eye and see if error appears. Thanks!
1,497
Posted By f_o_555
Thank you, Ravinder, it works, but not for all...
Thank you, Ravinder, it works, but not for all files.
Sometimes I get only

AAAAA
BBBBB
CCCCC
DDDDD
EEEEE


It may be an issue with the formatting, which I'm currently investigating....
1,497
Posted By f_o_555
Find and sort by first column value
Hi,
I have two text files
file 1 with N lines

AAAAA 2.092290E-12
BBBBB 1.727740E-07
CCCCC 9.608710E-17
DDDDD 0.000000E+00
EEEEE 0.000000E+00
FFFFF 0.000000E+00
GGGGG 0.000000E+00...
1,899
Posted By f_o_555
Multiplication of two files and and sorting
Hi,
I have 2 ASCII files, say
file1


AAAAA 3.465830E-12
BBBBB 4.263280E-08
CCCCC 1.113320E-17
DDDDD 0.000000E+00
...


file2 with as many lines as file1


3.932350E-12
1.194380E-07 ...
1,688
Posted By f_o_555
Sum product of even/odd lines
Hi,
I have a text file like this

6.0000E-02 0.00000E+00 0.0000 0.00000E+00 0.0000
7.0000E-02 5.00000E-10 1.0000 5.00000E-10 1.0000
8.0000E-02 3.00000E-09 0.4082 ...
2,120
Posted By f_o_555
If I use if [ -f "$file_name" ]; then ...
If I use

if [ -f "$file_name" ]; then
echo File $file_name Found
else
echo File $file_name Not Found
fi

then it works in the opposite direction I hae the impression, i.e....
2,120
Posted By f_o_555
So how the final script should be e.g. in the...
So how the final script should be e.g. in the first case?
2,120
Posted By f_o_555
if test in bash - can't see error
Hi,
I have the following script under bash

if [ test -f "$file_name" ]; then
echo File $file_name Not Found
else
echo File $file_name Found
...
1,551
Posted By f_o_555
I just would like to do something if one is...
I just would like to do something if one is greater than the other; something like

if(${a}>${b})
echo 1
else
echo 2
1,551
Posted By f_o_555
IF statement on floating point variable in scientific format
Hi all,
I'm struggling :wall: to make a an if statement on two variables in scientific format.
e.g.
a=1.23e+01
b=3.21e+02


I know that it can be done with bc if the variable are not in...
1,924
Posted By f_o_555
Ok, almost there. The numbers in the third column...
Ok, almost there. The numbers in the third column are not what is needed.
It should be.
AA124 0.60273000 6.141498e+02
AA124 0.63239000 6.141498e-01
AA124 0.64585000 4.636831e+01
BB152 0.66250000...
1,924
Posted By f_o_555
Ok; but I get something different. BB152 ...
Ok; but I get something different.
BB152 6.279650E+02
AA124 6.279650E+02
instead of
AA124 0.60273000 6.141498e+02
AA124 0.63239000 6.141498e-01
AA124 0.64585000 4.636831e+01
BB152...
1,924
Posted By f_o_555
I get nothing...
I get nothing...
1,924
Posted By f_o_555
It does! file2 should be file1 though in your...
It does! file2 should be file1 though in your suggestion.
I wanted to remove the lines below a certain value of v
Thank you
1,924
Posted By f_o_555
Selective multiplication of two columns in two files
Hi again,
I have two files
e.g. file2
e.g. file1
BB152 6.279650E+02
AA124 6.279650E+02


AA124 6.0273E-01 9.7800E-01
AA124 6.3239E-01 9.7800E-04
AA124 6.4585E-01 7.3839E-02
BB152 ...
Showing results 1 to 25 of 169

 

Featured Tech Videos

All times are GMT -4. The time now is 11:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy