awk Script: removing periodic boundaries


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk Script: removing periodic boundaries
# 1  
Old 07-23-2013
awk Script: removing periodic boundaries

SOLVED, thank you!

Edit2:


Good news everyone,

I managed to get it down to a "simple" problem, but I still have some syntax issues.

Here is the code which troubles me:
Code:
awk 'BEGIN{x2=0;x1=0;crit=0;}
$1 < 1000000 {x2=$4; diffx=x2-x1; x1=x2;
diffx > 3.6 ? {crit=1} : {crit=0};
crit==1 {print $1,$2,$3,$4-193.957,$5,$6}
crit==0 {print $1,$2,$3,$4,$5,$6}}

What I want to do is the following. $4,$5,$6 represent x,y,z coordinates.
If diffx > 3.6 I want to set crit to value 1 from 0, if the crit == 1 I want all the following x values ($4) to be
substracted by value 193.957... and until I reach the point where the crit is set 1 I just want to print out $1-$6.

Maybe it is a simple problem for you and you can help me fix it!

Thank you!


SOLVED, thank you!
SOLVED, thank you!

Last edited by Consti; 07-23-2013 at 11:12 AM..
# 2  
Old 07-23-2013
solved.

Last edited by rdrtx1; 07-23-2013 at 02:37 PM..
# 3  
Old 07-23-2013
The value of X is between 0-200, the origin of the coordination system lies in one of the edges of the simulation box. So your command will just be the same as print $0.

---------- Post updated at 04:13 PM ---------- Previous update was at 03:16 PM ----------

SOLVED, thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

Vuejs Periodic Table by Kadin Zhang

Was working on Vue.js and stumbled upon this beautiful Vue project by Kadin Zhang Periodicity is a dynamic periodic table built with Vue.js that animates and graphs data to aid the visualization of chemical concepts. The code is available on GitHub (2 Replies)
Discussion started by: Neo
2 Replies

2. Shell Programming and Scripting

awk word boundaries not working

Hi, I am trying below code but the word boundaries not seem to be working. What am I doing incorrectly? echo " ECHO " | awk '{ q="ECHO" ; if ( $0 ~ /\bq\b/) print "HELLO" ; }' OR echo " ECHO " | awk '{ q="ECHO" ; if ( $0 ~ /\b'$q'\b/) print "HELLO" ; }' Or echo " ECHO " | awk... (6 Replies)
Discussion started by: ahmedwaseem2000
6 Replies

3. Ubuntu

Wireless periodic drops - Ubuntu 12.10

Ubuntu wireless has been fine until fresh installation of 12.10. Now, I have periodic drops of the wireless. I can manually disconnect and then reconnect to get the service back. Sometimes, I am unable to disconnect. When this happens, I have to log off and then on again. (0 Replies)
Discussion started by: jamarsh
0 Replies

4. Programming

Periodic thread with clock_nanosleep

Hi I have a periodic task (with the highest priority) which I away every X nano-second. I am using the function clock_nanosleep with REAL_TIME timer. when I wake up, I versify that I was awake on time, and check if the delta between the last time I get to sleep and the current time is X... (4 Replies)
Discussion started by: laro1983
4 Replies

5. Linux

Need awk script for removing duplicate records

I have log file having Traffic line 2011-05-21 15:11:50.356599 TCP (6), length: 52) 10.10.10.1.3020 > 10.10.10.254.50404: 2011-05-21 15:11:50.652739 TCP (6), length: 52) 10.10.10.254.50404 > 10.10.10.1.3020: 2011-05-21 15:11:50.652558 TCP (6), length: 89) 10.10.10.1.3020 >... (1 Reply)
Discussion started by: Rastamed
1 Replies

6. Programming

key_t type max length or boundaries value

Hello, In shared memory, when using shmget function, first parameter is ket_t key. I know it is an integer type, but length of it is system dependent. That means may not be have integer's ranges. What is range of key_t in Linux? Is it different in distros, for example in ubuntu & fedora? (2 Replies)
Discussion started by: pronetin
2 Replies

7. Shell Programming and Scripting

Removing first column using awk script

I have this awk script. I have two different methods to remove the first column. However defining method = 1 in the BEGIN produces different results than when defining method = 1 later on instead. Any idea what it might be doing differently??? :rolleyes: BEGIN { Version = "V05" ... (4 Replies)
Discussion started by: kristinu
4 Replies

8. Shell Programming and Scripting

Word boundaries in GAWK?

I wanted to use GAWK's 'word boundary' feature but can't get it to work. Doesn't GAWK support \<word\>? Sample record: Title Bats in the fifth act of Chushingura (top); the... (6 Replies)
Discussion started by: Bubnoff
6 Replies

9. Linux

Need awk script for removing duplicate records

I have huge txt file having millions of trade data. For e.g Trade.txt (first 8 lines in the file is header info) COB_DATE,TRADE_ID,SOURCE_SYSTEM_TRADE_ID,TRADE_GROUP_ID, TRADE_TYPE,DEALER_NAME,EXTERNAL_COUNTERPARTY_ID, EXTERNAL_COUNTERPARTY_NAME,DB_COUNTERPARTY_ID,... (6 Replies)
Discussion started by: nmumbarkar
6 Replies

10. UNIX for Dummies Questions & Answers

create a periodic execution of a script?

Hello every body goal: create a script that control periodicly ( every 30 min ) if a process is already actif. How can I do that? thanks (3 Replies)
Discussion started by: hoang
3 Replies
Login or Register to Ask a Question