Search Results

Search: Posts Made By: liuzhencc
1,077
Posted By liuzhencc
Frustrating in splitting text files
Dear all,

I have been working with a very large text file manually. I'm ordering how to do this with a script. The gamma should be straightforward:

I just want split the text into multiple...
1,077
Posted By liuzhencc
Frustrating in splitting text files
Duplicate threads merged

Dear all,

I have been working with a very large text file manually. I'm ordering how to do this with a script. The gamma should be straightforward:

I just want split...
1,769
Posted By liuzhencc
MAGIC!!! (j%4?"":j?ORS i:"") OFS, $(++c) ...
MAGIC!!!

(j%4?"":j?ORS i:"") OFS, $(++c)
This is the most difficult Part I never understand.. But it does the trick! Thanks so much for your help!
ZHen
1,769
Posted By liuzhencc
It should be exact with 1+2+...+n, that says 55...
It should be exact with 1+2+...+n, that says 55 for n=10 because it is generated by a quantum chemical calculation. If number of numbers are large than 55, then just neglect the numbers in the...
1,769
Posted By liuzhencc
Sorry for my English. The logic is not complex....
Sorry for my English.
The logic is not complex. if we have a number n, the we have 1+2+3+...+n numbers in the input file separated by comma. the output is formatted as follows if n =10,

1 num1
2...
1,769
Posted By liuzhencc
Hi Singh, thanks for the reply. It does the job...
Hi Singh, thanks for the reply.
It does the job partially because the maximum numbers in one line must be limited to 4. That means the n=1 with 1 number; n=2 with 2; n=3 with 3; n=4 with 4; when n >...
1,769
Posted By liuzhencc
Hi RudiC, thanks for reply. I think it could be...
Hi RudiC, thanks for reply.
I think it could be done by a loop combining with awk.
However, I'm not a skillful user with awk.
I have tried for several hours without any progress. The difficulty...
1,769
Posted By liuzhencc
Data manipulation, Please help..
Hello,

I have a huge set of data that needs to be reformatted.
Here is a simple example to explain the process.
I have number n=5 and a input with many numbers separated with comma:

...
2,550
Posted By liuzhencc
Indeed, I thought about this. What if I have to...
Indeed, I thought about this. What if I have to print the previous m lines before a third pattern? That means it is a mixed process of backward search with pattern 3 and two forward searches with...
2,550
Posted By liuzhencc
Many thanks. You are always come with a super...
Many thanks. You are always come with a super concise, super smart script to solve the problem. May I kindly ask a further question on this problem? How to modified this script if I want to print "2"...
2,550
Posted By liuzhencc
Thanks. I think perl is installed as default with...
Thanks. I think perl is installed as default with Ubuntu 14. That's already very good to get job done with perl. Is that any possibility to use sed or awk? I suppose either sed or awk should be able...
2,550
Posted By liuzhencc
How to print different multiple lines after two patterns?
Hello,

I need to print some lines as explained below,
TXT example

1111
2222
3333
4444
5555
6666
7777
8888
6666
9999
1111
2222
3333
4444
5555
3,658
Posted By liuzhencc
Great! Now, these two rows are aligned within...
Great! Now, these two rows are aligned within each column. The output is perfectly formatted.
Would you please explain a little bit on 'split', 'sprintf', 'OFS', 'h ORS r'?
How does it work? It's...
3,658
Posted By liuzhencc
Thanks so much for the script. It works like a...
Thanks so much for the script. It works like a charm.
Would you please give me some explanation about this script? How does it works so fast. Since you use unformatted print inside awk, so the bond...
3,658
Posted By liuzhencc
Calculate root mean square?
Dear friend,

I know for a single case, this could be finished quickly with Excel. But if we have hundreds of files, we definitely want to do it with a script or a FORTRAN code. Since I have no...
1,500
Posted By liuzhencc
Text replacement with awk or sed?
Hi guys,

I worked for almost a half-day for the replacement of some text automatically with script. But no success.
The problem is I have hundred of files, which need to be replaced with some...
1,735
Posted By liuzhencc
The whole loop is in a single awk! Great! It's...
The whole loop is in a single awk! Great! It's exactly what I expected.

---------- Post updated at 03:48 AM ---------- Previous update was at 02:13 AM ----------



Why only '0' printed...
1,735
Posted By liuzhencc
Sorry for my ambiguous expression. Actually, I...
Sorry for my ambiguous expression. Actually, I want 11 outputs. Each of these outputs will be written to a new file. I could do this within the for loop to prepare 11 outputs. I never know awk could...
1,735
Posted By liuzhencc
Hi Rudic, you are a genius and always write a...
Hi Rudic, you are a genius and always write a script with mysterious awk to do the magic things! Where is i? I need to get 11 points from a1 to a2 including a1 when i=0 and a2 when i=1 and other...
1,735
Posted By liuzhencc
because I have no idea how to do this use awk ,...
because I have no idea how to do this use awk , bash, or python, or fortran.
I know it would be not so hard, but I just tried and I have no clue on this problem.
The main function is to use a...
1,735
Posted By liuzhencc
Array manipulation with awk?
Dear friends,

I'm wondering if we could do some simple math on two arrays with the same size?
a1

Fe -0.21886700 -0.01417600 -0.24390300
C 2.20529400 ...
2,245
Posted By liuzhencc
Great! I forgot to do it in the beginning! It...
Great! I forgot to do it in the beginning! It makes life even more simple! Thanks!
2,245
Posted By liuzhencc
Hi RudiC, Yes, indeed. I should post this...
Hi RudiC,

Yes, indeed. I should post this add-up function to that post instead to start a new thread. Can I merged these two threads at this moment?
You are really a great bash programmer!! I...
2,245
Posted By liuzhencc
FREQ0=$1 for i in $(ls *.log | sed...
FREQ0=$1

for i in $(ls *.log | sed "s/.log//g");do

NUM1=$(sed -n 28p ${i}.in)
NUM2=$((NUM1 + 28))

for ((j=29;j<=$NUM2;j++)); do
FREQ1=$(sed -n ${j}p ${i}.in)

awk -v LINE="$j" -v...
2,245
Posted By liuzhencc
Comparing floating number and replace the smaller one with awk?
Hi guys,

I tried to write a script for replacing some number in a bunch of files. However, I failed because my limited bash scripting knowledge.
Here I will explain the expected function:

I...
Showing results 1 to 25 of 72

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