Sponsored Content
Top Forums Shell Programming and Scripting Constructing numbers from input lines Post 302489960 by kristinu on Sunday 23rd of January 2011 02:11:08 AM
Old 01-23-2011
That's correct

Actual file might actually be like this. Want to strip away the first entry but remember the value in the line 0.50 where I need to divide the last number with 0.50

Code:
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:0. Rms Value    = 0.00551131
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:1. Rms Value    = 0.0105689
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:2. Rms Value    = 0.0137097
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:3. Rms Value    = 0.0163874
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:4. Rms Value    = 0.0187422
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:5. Rms Value    = 0.0197708
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:6. Rms Value    = 0.0208463
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:7. Rms Value    = 0.0217194
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:8. Rms Value    = 0.0226114
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:9. Rms Value    = 0.0229611
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:10. Rms Value    = 0.0239331
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:11. Rms Value    = 0.025327
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:12. Rms Value    = 0.0250741
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:13. Rms Value    = 0.0255705
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:14. Rms Value    = 0.0266015
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:15. Rms Value    = 0.0268534
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:16. Rms Value    = 0.0264882
npt02-z30-sr65-rgdt0p50-dc0p006-16x12drw-run1.log:17. Rms Value    = 0.0269775

Actually it would be good to store the value 0.50 and store it so I can determine 1/(0.5*0.5), then multiply
the last number by this value.

I should end up with

Code:
0. Rms Value    = 0.00551131/(0.50*0.50)
1. Rms Value    = 0.0105689/(0.50*0.50)
2. Rms Value    = 0.0137097/(0.50*0.50)
3. Rms Value    = 0.0163874/(0.50*0.50)
4. Rms Value    = 0.0187422/(0.50*0.50)
5. Rms Value    = 0.0197708/(0.50*0.50)
6. Rms Value    = 0.0208463/(0.50*0.50)
7. Rms Value    = 0.0217194/(0.50*0.50)
8. Rms Value    = 0.0226114/(0.50*0.50)
9. Rms Value    = 0.0229611/(0.50*0.50)
10. Rms Value    = 0.0239331/(0.50*0.50)
11. Rms Value    = 0.025327/(0.50*0.50)
12. Rms Value    = 0.0250741/(0.50*0.50)
13. Rms Value    = 0.0255705/(0.50*0.50)
14. Rms Value    = 0.0266015/(0.50*0.50)
15. Rms Value    = 0.0268534/(0.50*0.50)
16. Rms Value    = 0.0264882/(0.50*0.50)
17. Rms Value    = 0.0269775/(0.50*0.50)


Last edited by kristinu; 01-23-2011 at 03:23 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is there any way to makesure that the input from the user is all numbers?

Is there any way to makesure that the input from the user is all numbers? thankz (5 Replies)
Discussion started by: XXXXXXXXXX
5 Replies

2. Shell Programming and Scripting

Accept user input - only numbers

I have a situation where I want the user to enter only numbers in response to a READ command. I have some validation to restrict the number to be between 1 and 12, but if the user type in some characters the script echoes some error message and goes to the next command. Below is a snippet of the... (1 Reply)
Discussion started by: pvar
1 Replies

3. Shell Programming and Scripting

How to remove all lines with something other than numbers

Hi, How would I get rid of lines having something else than numbers (such as tabs,white space, special characters, empty line, letters). So I have big file with numers as follows: 12345678901 23456789012 32343678901 42345638901 52345678901 and I sometimes the file might contain some... (2 Replies)
Discussion started by: Juha
2 Replies

4. UNIX for Dummies Questions & Answers

Negative Numbers for input parameters.

Hello, I have a command that I need to supply a negative number as a parameter; how do I do this? I have tried giving it with double quotes, "", but no avail. Thanks, Gussi (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

5. Shell Programming and Scripting

Suggestions on constructing a log file

Hi, I have a series of BASH shell scripts that run together. I would like it so that these scripts construct a log file as they run. This log file would ideally be a text file that contains exactly (including blank lines) what is output to the terminal. What is the best way to accomplish... (3 Replies)
Discussion started by: msb65
3 Replies

6. UNIX for Dummies Questions & Answers

constructing a file for printing

I have a text file, data.txt, which looks like :- head1 head2 head3 data1 1 data 1 2 data 1 3 data 2 1 data 2 2 data 2 3 data 3 1 data 3 2 data 3 3 etc etc I would like to print this file, using the lp -d command, with a heading line, as follows :- Report for whatever department as... (2 Replies)
Discussion started by: malts18
2 Replies

7. Shell Programming and Scripting

input of two numbers in the middle of the script

Hi, My script ask for the input of two numbers in the middle of it. I would like to know how to indicate this two numbers when I submit the script. thanks for any help, jalves (4 Replies)
Discussion started by: jalves
4 Replies

8. UNIX for Dummies Questions & Answers

Extraction of numbers from input

I have the following input: xxxx-2.7.19_WR3 I have extract the following: 2.7.19 Can anyone suggest an awk or sed command to do the above...:confused: another condition is if the input is : xxx-xxx_xxx-1.4-1_WR3.0bg.armv6jel_vfp it shud still extract : 1.4-1 whenever "-"... (12 Replies)
Discussion started by: xerox
12 Replies

9. Shell Programming and Scripting

Constructing a Matrix

Hi, I do have couple of files in a folder. The names of each of the files have a pattern. ahet_005678.txt ahet_005898.txt ahet_007678.txt ahet_004778.txt ... ... ahet_002378.txt Each of the above files have the same pattern of data with 4 columns and have an header for the last 3... (4 Replies)
Discussion started by: Kanja
4 Replies

10. Shell Programming and Scripting

Reducing the decimal points of numbers (3d coordinates) in a file; how to input data to e.g. Python

I have a file full of coordinates of the form: 37.68899917602539 58.07500076293945 57.79100036621094 The numbers don't always have the same number of decimal points. I need to reduce the decimal points of all the numbers (there are 128 rows of 3 numbers) to 2. I have tried to do this... (2 Replies)
Discussion started by: crunchgargoyle
2 Replies
PAM_FILTER(8)							 Linux-PAM Manual						     PAM_FILTER(8)

NAME
pam_filter - PAM filter module SYNOPSIS
pam_filter.so [debug] [new_term] [non_term] run1|run2 filter [...] DESCRIPTION
This module is intended to be a platform for providing access to all of the input/output that passes between the user and the application. It is only suitable for tty-based and (stdin/stdout) applications. To function this module requires filters to be installed on the system. The single filter provided with the module simply transposes upper and lower case letters in the input and output streams. (This can be very annoying and is not kind to termcap based editors). Each component of the module has the potential to invoke the desired filter. The filter is always execv(2) with the privilege of the calling application and not that of the user. For this reason it cannot usually be killed by the user without closing their session. OPTIONS
debug Print debug information. new_term The default action of the filter is to set the PAM_TTY item to indicate the terminal that the user is using to connect to the application. This argument indicates that the filter should set PAM_TTY to the filtered pseudo-terminal. non_term don't try to set the PAM_TTY item. runX In order that the module can invoke a filter it should know when to invoke it. This argument is required to tell the filter when to do this. Permitted values for X are 1 and 2. These indicate the precise time that the filter is to be run. To understand this concept it will be useful to have read the pam(3) manual page. Basically, for each management group there are up to two ways of calling the module's functions. In the case of the authentication and session components there are actually two separate functions. For the case of authentication, these functions are pam_authenticate(3) and pam_setcred(3), here run1 means run the filter from the pam_authenticate function and run2 means run the filter from pam_setcred. In the case of the session modules, run1 implies that the filter is invoked at the pam_open_session(3) stage, and run2 for pam_close_session(3). For the case of the account component. Either run1 or run2 may be used. For the case of the password component, run1 is used to indicate that the filter is run on the first occasion of pam_chauthtok(3) (the PAM_PRELIM_CHECK phase) and run2 is used to indicate that the filter is run on the second occasion (the PAM_UPDATE_AUTHTOK phase). filter The full pathname of the filter to be run and any command line arguments that the filter might expect. MODULE TYPES PROVIDED
All module types (auth, account, password and session) are provided. RETURN VALUES
PAM_SUCCESS The new filter was set successfully. PAM_ABORT Critical error, immediate abort. EXAMPLES
Add the following line to /etc/pam.d/login to see how to configure login to transpose upper and lower case letters once the user has logged in: session required pam_filter.so run1 /lib/security/pam_filter/upperLOWER SEE ALSO
pam.conf(5), pam.d(5), pam(7) AUTHOR
pam_filter was written by Andrew G. Morgan <morgan@kernel.org>. Linux-PAM Manual 06/04/2011 PAM_FILTER(8)
All times are GMT -4. The time now is 03:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy