This is my first post, and I am relatively new to linux/unix scripts. I am writing a bash script in which I am trying to extract one line from another file and parse specific words from the line into an array. So for example, I have a file called SortScans in which the first 5 lines might look like this (nevermind that this file is in csh):
and in my new script, I want to create 2 arrays that would correspond just to what's inside those parentheses, where the end result would be the following 2 arrays
So here is the code that I am using so far in my script just to create RunsArray
I don't really know what I'm doing there, I just sort of copy pasted different related things I've seen on forums. But I'm getting the following error on the sed part -
sed: can't read set: no such file or directory
and that error repeats for each word or number down the line (i.e. runs, =, (2, 3, 4, etc.)
Anybody think they can help me out? Like I said I'm just starting out, so if you think you have a better way of doing this altogether, I would love to hear it. Thanks y'all.
Thanks very much, I will try that. But will this work without the final forward slash for the sed command - after the } and before the '? Could you explain why it isn't needed there?
Hello
I am using gfortran and I intended to do thiis:
Module variables
character(len=:), dimension(:), allocatable, array
end module variables
Sub test
use variables
integer (max_len)
max_len=len_trim("something here")
if(.not.allocated(array))... (1 Reply)
I have the following code and for some reason when I call the program using
/home/tcdata/tatsh/trunk/hstmy/bin/bash/raytrac.bash --cmod=jcdint.cmod
I get
hasArgument =
hasArgument = true
Somehow the array element is returning even though I have not chosen the option.
... (41 Replies)
Hello,
Please find an ugly code. bouuu.
It shall work onto RAM only to update from the last 10 strings from $URLTO. I shall read first : "$HOME/.fvwmoscfg/fvwmclipboardmplayerplayurl10.ini"
The code works but it is very ugly. How could it be made elegant please?
Thank you
... (2 Replies)
Hi to everyone,
Please some help over here.
Hi have array a with 6 elements and array b with 3 elements as shown inside BEGIN{} statement.
I need help to get the correct sintax (the part in red) to compare if string from array b is in array a and print the number
related for each match.... (3 Replies)
Hi There,
Code:
Number=10
i=1
while
do
echo "$i"
Check=`find $viewing -name $File_Pattern -type f -Print`
i=`expr ${i} + 1`
done
Unable to store the values in variable 'Check', when i display i am getting Check nothing... (1 Reply)
hi i am using bash shell to perform some subraction. here is what i have:
i have a while loop and am using i as a counter.
diff= `expr ${ARRAY1} - ${ARRAY2}`
for example array1 has -0.7145 and array2 has -0.7041.
when i try the above command, i get expr: non-numeric argument. any... (6 Replies)
hi,
i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
hi guys,
i have the following script and when i run it i get blank lines on the screen.. i am trying to display the contents of array var..
#!/usr/bin/bash
var=`awk 'NR>20&&NR<31' try.sum | awk '{print $4}'`
echo "${var}" (1 Reply)
:confused:
Is it possible to delete array elements dynamically.For instance,consider an array( a b c d ) ,now can i delete array (the third element 'c').So that the array becomes array(a b d)..
Thanks in advance!! (1 Reply)
Hi there,
im having issue with comparing two variables, in a bash script.
im trying to do the following:
- get a word from user 1
- split the word into array
- get a character from user2
trying to compare the character entered by user 2 with every single character in the array... (2 Replies)