10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have the text file where each line has the format:
chr10 101418889 101418904 0.816327
Right now the interval between column 2 and 3 is 15. I only want the two consecutive positions starting at position 1, write it to a file, then move up one position write to file etc. So that:
... (1 Reply)
Discussion started by: jfern
1 Replies
2. Shell Programming and Scripting
Here's my code:
awk -F '' 'NR==FNR {
if (/time/ && $5>10)
A=$2" "$3":"$4":"($5-01)
else if (/time/ && $5<01)
A=$2" "$3":"$4-01":"(59-$5)
else if (/time/ && $5<=10)
A=$2" "$3":"$4":0"($5-01)
else if (/close/) {
B=0
n1=n2;
... (2 Replies)
Discussion started by: klane
2 Replies
3. UNIX for Dummies Questions & Answers
Good evening all I have what might be a simple problem to solve but I do not know how to solve it myself. I am writing a bash script and my code looks something like this:
mp3=`ls | grep \.mp3`
for f in $mp3
do
echo $f
done
Basically what I want to do is look through the current... (4 Replies)
Discussion started by: mistsong1
4 Replies
4. Shell Programming and Scripting
Hello All,
Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....?
I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping
through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies
5. UNIX for Dummies Questions & Answers
#!/bin/bash
function check_num_args()
{
if ; then
echo "Please provide a file name"
else
treat_as_file $*
fi
}
function treat_as_file()
{
numFiles=$#
for((i=1;i<=$numFiles;i++));do
echo $i
... (3 Replies)
Discussion started by: kikilahooch
3 Replies
6. Programming
HI there,
I am trying to count manually what this code does but I am stuck and I don't learly see the result. The code works and it compiles and runs but I just don't follow the value of var.
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
#include<wait.h>... (2 Replies)
Discussion started by: bluetxxth
2 Replies
7. Shell Programming and Scripting
When I run the following command in the shell it works fine. It prints a city name and then a path for a file.
~$ for i in `awk -F':' '{print $0}' /home/knoppix/Desktop/data/subs | grep -m 1 $ city | sed "s/:/ /"`
>do
>echo $i
>done
Now, when I place it in this shell script (sh) it prints... (6 Replies)
Discussion started by: afroCluster
6 Replies
8. Shell Programming and Scripting
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies
9. Shell Programming and Scripting
i don't get what's wrong here. i'm writing a shell script that takes 1 argument (a number) from the command-line, but it's throwing an error:
Syntax error: Bad for loop variable
doesn't make much sense
for (( i = 1; i = ${1}; i++ )) # error points to this line everytime
do
echo... (9 Replies)
Discussion started by: visitorQ
9 Replies
10. Shell Programming and Scripting
I have seen this done before - and maybe there is a better way too.
I want to be abe to use a for loop (or other better method) to loop through the database instance names that are part of the script - not an external file where a read might be ok.
Here is what I have and I know won't work -... (5 Replies)
Discussion started by: dave-mentor
5 Replies