Editing lists of integers in 1d files with bash shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Editing lists of integers in 1d files with bash shell
# 1  
Old 02-11-2010
Editing lists of integers in 1d files with bash shell

Hi, I need a script that will:

1. Go through about 20 different folders, each containing about 20 1d files. The 1d files go something like this:

22.253 37.707 78.117 112.374 127.944 156.067 180.956 233.785 249.256 301.77 323.443 335.713 390.947 406.268 430.892 476.657
22.283 28.352 67.982 113.863 116.898 168.799 196.208 232.854 248.192 275.585 315.298 354.911 361.063 412.964 443.458 464.947

2. Take each integer and subtract 1.5 from it, saving a new 1d file that looks exactly like the above text but each integer is 1.5 less.

Thanks for the help!
# 2  
Old 02-11-2010
Tools Maybe give you something to think about?

Code:
>echo 22.253 37.707| tr " " "\n" | gawk '{val=$1-1.5; print val}' | tr "\n" " "
20.753 36.207

I know it does not do exactly what you asked for, but it starts to handle some of the issues.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script deleting my files, and editing files in subdirectories question

#!/bin/bash # name=$1 type=$2 number=1 for file in ./** do if then filenumber=00$number elif then filenumber=0$number fi tempname="$name""$filenumber"."$type" if (4 Replies)
Discussion started by: TheGreatGizmo
4 Replies

2. Shell Programming and Scripting

Bash Integers/String

Hy friends, I am newbie to bash scripting, can anyone explain how b=${a/23/BB} # Substitute "BB" for "23". this line converts "b" into string and and "d" into Integer. Thanks in advance (4 Replies)
Discussion started by: Qazi
4 Replies

3. Shell Programming and Scripting

Grep float/integers but skip some integers

Hi, I am working in bash in Mac OSX, I have following 'input.txt' file: <INFO> HypoTestTool: >>> Done running HypoTestInverter on the workspace combined <INFO> HypoTestTool: The computed upper limit is: 11 +/- 1.02651 <INFO> HypoTestTool: expected limit (median) 11 <INFO> HypoTestTool: ... (13 Replies)
Discussion started by: Asif Siddique
13 Replies

4. Shell Programming and Scripting

Shell script that lists files with different owner than the folder

Hello, I'm trying to write a script which is listing files based on different preferences, like filetype or permissions. All is fine, except for one: I want to list files in /home which has a different owner than the home directory it is in. Here is an example: /home/UserA is the directory, and... (10 Replies)
Discussion started by: Zwiebi
10 Replies

5. Shell Programming and Scripting

Shell Script to Create non-duplicate lists from two lists

File_A contains Strings: a b c d File_B contains Strings: a c z Need to have script written in either sh or ksh. Derive resultant files (File_New_A and File_New_B) from lists File_A and File_B where string elements in File_New_A and File_New_B are listed below. Resultant... (7 Replies)
Discussion started by: mlv_99
7 Replies

6. Web Development

bash script editing my apache config files

okay i'm going to try to say this uber-simple: I use dropbox (file-sync service). in order for dropbox sync files, they must be its children eg. somewhere under /home/jzacsh/Dropbox]. I want to now use it to keep my development files in sync across my machines: easy: just move my dev. files... (2 Replies)
Discussion started by: jzacsh
2 Replies

7. Shell Programming and Scripting

Passing Integers to shell script from java

i have to pass an integer value to shell script which will mail the values to users. I am able to pass string values like this. try { String strCmdToRun1 = new String { "sh", "mail.sh","hello"}; Process p1 = rtime.exec(strCmdToRun1); BufferedReader output... (1 Reply)
Discussion started by: naveensraj
1 Replies

8. Shell Programming and Scripting

bash problem when comparing integers

Hi, When I compare currentfiledate to reportfiledate I get a "-bash: currentfiledate=20090220080101 reportfiledate=20090219231245 if ; then echo -ne "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n" echo -ne "!! Running the load utility !! \n" fi Our... (15 Replies)
Discussion started by: rbournival
15 Replies

9. Shell Programming and Scripting

Editing files in shell programing

Hi folks, In our product installation program we edit xml files by deleting lines and appending new lines instead of them. For example: update_Log4plsql_xml() { machineName=`uname -n` hostIP=`cat /etc/hosts | grep ${machineName} | cut -f1` trap 'clean_up | tee -a $installLog ; exit' 1 2... (0 Replies)
Discussion started by: nir_s
0 Replies

10. UNIX for Dummies Questions & Answers

how do you represent non integers in a shell script?

am trying to write a script that test that the load average which is taken from the uptime command's output to make sure it doesn't pass a certain limit. each time I execute the script, it complains about interger errors. if (2 Replies)
Discussion started by: TRUEST
2 Replies
Login or Register to Ask a Question