Grep final set of parameters from fit.log gnuplot file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep final set of parameters from fit.log gnuplot file
# 8  
Old 04-03-2013
In your original problem, each entry in fit.txt contained 3 lines that contained the string +/- and the awk script I supplied plucked a value from each of these lines and added a new line after find the 3rd matched line in each entry:
Code:
awk -F' *=* +' '/[+]\/-/{printf "%s%s",$2,(++i%3)?" ":"\n"}' fit.txt

Now fit.txt contains entries each of which has 4 lines that contain the string +/- and guess what: the awk script:
Code:
awk -F' *=* +' '/[+]\/-/{printf "%s%s",$2,(++i%4)?" ":"\n"}' fit.txt

will do what you want. With you new fit.txt sample file, it produces:
Code:
0.498062 -0.00287463 -0.017153 -0.0145765
0.497897 -0.00459203 -0.0162969 -0.0139438
0.49692 -0.00889774 -0.0210222 -0.0182511

See the pattern? This pattern will work as long as the number of variables you're concerned about is a constant for any given input file. The logic would be more complex if the number of fields were to vary between entries.
This User Gave Thanks to Don Cragun For This Post:
# 9  
Old 04-03-2013
Thanks Don Cragun. It works like magic!!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Different set key multiplot gnuplot

Hello everybody, I am using Windows 10. I need to plot several graphs simultaneously with Gnuplot. The script is: GNUTERM = "wxt" set terminal wxt set termoption enhanced set encoding iso_8859_1 set multiplot layout 2,3 set xtics out set ytics out set xtics nomirror set ytics... (4 Replies)
Discussion started by: supernono06
4 Replies

2. Shell Programming and Scripting

Getopt eval set parameters not happening when the script is called through an application!

Hi, There is an Informatica tool through which unix scripts can be called. Now the requirement in my project is that a parent script calls a child script but this parent script has to be called through the Informatica tool. In Parent script I'm using TEMP=`getopt -o x:y: -l area:,volume:... (1 Reply)
Discussion started by: Panna
1 Replies

3. Shell Programming and Scripting

How do i check if all parameters are set in bash?

Hi, I have 4 parameters passed to my shell and i validate if all four are entered using the following snippet: if then echo "Not entered" else echo "entered" fi I get the following output as 'Not entered even when i enter the values for all prompts. Please advise. Thanks. (5 Replies)
Discussion started by: Jesshelle David
5 Replies

4. Linux

Gnuplot terminal set to 'unknown'

I installed version 4.6.4 of gnuplot recently on my system running 10.04 ubuntu linux. I am getting error Terminal type set to 'unknown' Also when i try to set term X11 or wxt i get error Terminal type set to 'unknown' ^ unknown or ambiguous terminal... (5 Replies)
Discussion started by: Ujjwal1982
5 Replies

5. Shell Programming and Scripting

Log-log plot in gnuplot and limiting the xrange

I am trying to fit a plot in gnuplot using logscale. I have 50000 data points. At first I fit plot in this way. f(x) = b + m*x fit f(x) "xyMSD-all-mal-cel-iso-bcm-thermo2.dat" using 1:2 via m,b I got slope value. Then I tried to get slope value at different range as below. fit f(x)... (2 Replies)
Discussion started by: vjramana
2 Replies

6. Shell Programming and Scripting

gnuplot set key issue

Hi I have a plotting function like this- plot '../processing_old/time0.txt' using 1:6 title "1.6" with boxes fs solid 0.05 ls 5,\ 'time0.txt' using 1:6 title "1.7" with boxes fs solid 0.05 ls 6,\ '../processing_new/time0.txt' using 1:6 title "2.0" with boxes fs solid... (8 Replies)
Discussion started by: jamie_123
8 Replies

7. Solaris

Which file is read by kernel to set its default system kernel parameters values?

Hi gurus Could anybody tell me which file is read by kernel to set its default system kernal parameters values in solaris. Here I am not taking about /etc/system file which is used to load kernal modules or to change any default system kernal parameter value Is it /dev/kmem file or something... (1 Reply)
Discussion started by: girish.batra
1 Replies

8. Shell Programming and Scripting

Call single function multiple times diff set of parameters

Okay, not sure if it can be done, I would think it could be done and I'm just having a hard time with it. fun_close_wait(){ ipVar="${1} ${2}" portVar=`cat "${5}" | cut -d' ' -f 1` for ip in $ipVar do for port in $portVar do netstatVar=`netstat -n | grep... (4 Replies)
Discussion started by: cbo0485
4 Replies

9. UNIX for Dummies Questions & Answers

least-square fit in Gnuplot

Does anyone know how to find the best least square fit in Gnuplot? (6 Replies)
Discussion started by: cosmologist
6 Replies
Login or Register to Ask a Question