Sponsored Content
Full Discussion: Help with a bash loop script
Top Forums UNIX for Beginners Questions & Answers Help with a bash loop script Post 303037352 by bakunin on Tuesday 30th of July 2019 10:12:21 AM
Old 07-30-2019
Here we go again analysing FASTA-files. I wonder if we are going to be mentioned in the dozens of biological research papers we have helped to create over time.

Quote:
Originally Posted by dre
Create a single bash script that does the following:
Sorry, but this is not the way that works.

First: you come across like a teacher posing the homework for us. Actually we are all professionals here and have done our homework meticulously which is why we don't have to do more homework any more. In case it was homework given to you by your teacher: there is a special forum for this with special rules in place. Please re-create the thread there and provide the necessary information.

Second, in case this is not homework but actually your work: we do not insist on a lot of social conventions here (after all, we are sysadmins - being somewhat autistic is part of the requirement for this job), but still a well-placed "please" here and there, along with some of the common niceties called "good manners" oils the social machinery. If you ever wonder who writes the answers to your questions: it is not some clever machine and a fat server - it is actually living, breathing persons.

Third and foremost: we are here to help you help yourself. If you want a shell-script - WRITE IT! Attempts, however failing, will count. If you tried and it didn't work, post what you did and the error you got trying to run it. We will, regardless of how long it will take, explain to you what was wrong and how to do it better (actually quite like the way i explain to you right now why you need to change your problem statement) until you understand. We will also point out ways to better solve the problem, different tools, suggest sources to find valuable information and so on and so on. But we will NOT write your code for you. We are a help forum, not your unpaid programming staff.

I hope this helps.

bakunin
These 2 Users Gave Thanks to bakunin For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

loop does not execute in bash script?

I have a very basic bash shell script, which has many "while... done; for .... done" loop clauses, like the following ~~ #!/bin/bash while blablalba; do .... done < /tmp/file for line in `cat blablabla`; do grep $line /tmp/raw ; done > /tmp/1; while blablalba2; do .... done <... (2 Replies)
Discussion started by: fedora
2 Replies

2. Shell Programming and Scripting

error in bash script 'if' loop

SEND_MESSAGE=test echo $SEND_MESSAGE if then echo `date` > update_dt_ccaps.lst echo "The file transfer failed" >> update_dt_ccaps.lst SEND_MESSAGE=false fi The above code is showing error in bash shell as : ./test: line 5: [: test: integer expression expected ... (2 Replies)
Discussion started by: DILEEP410
2 Replies

3. Shell Programming and Scripting

Whitespace in filenames in for loop in bash script

I'm trying to search all .odt files in a directory for a string in the text of the file. I've found a bash script that works, except that it can't handle whitespace in the filenames. #!/bin/bash if ; then echo "Usage: searchodt searchterm" exit 1 fi for file in $(ls *.odt); do ... (4 Replies)
Discussion started by: triplemaya
4 Replies

4. Shell Programming and Scripting

Getting error on for loop - bash script

Hi, I am working on bash script after a long time. I am getting error near done statement while running a for loop snippet. The error says "Syntax error near unexpcted token 'done'" please suggest what could be wrong. here is the snippet elements=${#option_arr} //an array of values... (1 Reply)
Discussion started by: arundhati_s
1 Replies

5. Shell Programming and Scripting

Expect script called in loop from Bash Script

Having issues with an expect script. I've been scripting bash, python, etc... for a couple years now, but just started to try and use Expect. Trying to create a script that takes in some arguments, and then for now, just runs a pwd command(for testing, final will be command I pass). Here is... (0 Replies)
Discussion started by: cbo0485
0 Replies

6. Shell Programming and Scripting

Bash script - loop question

Hi Folks, I have a loop that goes through an array and the output is funky. sample: array=( 19.239.211.30 ) for i in "${array}" do echo $i iperf -c $i -P 10 -x CSV -f b -t 50 | awk 'END{print '$i',$6}' >> $file done Output: 19.239.211.30 19.2390.2110.3 8746886 seems that when... (2 Replies)
Discussion started by: nitrohuffer2001
2 Replies

7. Shell Programming and Scripting

While loop with input in a bash script

I have the following while loop that I put in a script, demo.sh: while read rna; do aawork=$(echo "${rna}" | sed -n -e 's/\(...\)\1 /gp' | sed -f rna.sed) echo "$aawork" | sed 's/ //g' echo "$aawork" | tr ' ' '\012' | sort | sed '/^$/d' | uniq -c | sed 's/*\(*\) \(.*\)/\2: \... (3 Replies)
Discussion started by: faizlo
3 Replies

8. Shell Programming and Scripting

Loop through multiple files in bash script

Hi Everybody, I'm a newbie to shell scripting, and I'd appreciate some help. I have a bunch of .txt files that have some unwanted content. I want to remove lines 1-3 and 1028-1098. #!/bin/bash for '*.txt' in <path to folder> do sed '1,3 d' "$f"; sed '1028,1098 d' "$f"; done I... (2 Replies)
Discussion started by: BabyNuke
2 Replies

9. Shell Programming and Scripting

How to use grep in a loop using a bash script?

Dear all, Please help with the following. I have a file, let's call it data.txt, that has 3 columns and approx 700,000 lines, and looks like this: rs1234 A C rs1236 T G rs2345 G T Please use code tags as required by forum rules! I have a second file, called reference.txt,... (1 Reply)
Discussion started by: aberg
1 Replies

10. UNIX for Beginners Questions & Answers

Help with date in bash script for loop from YYYYMMDDHHMM

Hi everyone I need some help I want to create an script which does some processing it takes the two arguments 201901010000 and 201901020200 - so YYYMMDDHHMM I want to split processing into hours from start until end, I dont get why this works but when I add to a future variable... (1 Reply)
Discussion started by: kl1ngac1k
1 Replies
MRTG-FAQ(1)							       mrtg							       MRTG-FAQ(1)

NAME
mrtg-faq - How to get help if you have problems with MRTG SYNOPSIS
MRTG seems to raise a lot of questions. There are a number of resources apart from the documentation where you can find help for mrtg. FAQ
In the following sections you'll find some additonal Frequently Asked Questions, with Answers. Why is there no "@#$%" (my native language) version of MRTG? Nobody has contributed a @#$%.pmd file yet. Go into the mrtg-2.17.4/translate directory and create your own translation file. When you are happy with it send it to me for inclusion with the next mrtg release. I need a script to make mrtg work with my xyz device. Probably this has already been done. Check the stuff in the mrtg-2.17.4/contrib directory. There is a file called 00INDEX in that directory which tells what you can find in there. How does this SNMP thing work There are many resources on the net that explain SNMP. Take a look at this article from the Linux Journal by David Guerrero http://www.david-guerrero.com/papers/snmp/ And at this rather long document from CISCO. http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/snmp.htm The images created by MRTG look very strange. Remove the *-{week,day,month,year}.png files and start MRTG again. Using MRTG for the first time, you might have to do this twice. This will also help when you introduce new routers into the cfg file. What is my Community Name? Ask the person in charge of your Router or try 'public', as this is the default Community Name. My graphs show a flat line during an outage. Why ? Well, the short answer is that when an SNMP query goes out and a response doesn't come back, MRTG has to assume something to put in the graph, and by default it assumes that the last answer we got back is probably closer to the truth than zero. This assumption is not perfect (as you have noticed). It's a trade-off that happens to fail during a total outage. If this is an unacceptable trade-off, use the unknaszero option. You may want to know what you're trading off, so in the spirit of trade-offs, here's the long answer: The problem is that MRTG doesn't know *why* the data didn't come back, all it knows is that it didn't come back. It has to do something, and it assumes it's a stray lost packet rather than an outage. Why don't we always assume the circuit is down and use zero, which will (we think) be more nearly right? Well, it turns out that you may be taking advantage of MRTG's "assume last" behaviour without being aware of it. MRTG uses SNMP (Simple Network Management Protocol) to collect data, and SNMP uses UDP (User Datagram Protocol) to ship packets around. UDP is connectionless (not guaranteed) unlike TCP where packets are tracked and acknowledged and, if needed, retransmitted. UDP just throws packets at the network and hopes they arrive. Sometimes they don't. One likely cause of lost SNMP data is congestion; another is busy routers. Other possibilities include transient telecommunications problems, router buffer overflows (which may or may not be congestion-related), "dirty lines" (links with high error rates), and acts of God. These things happen all the time; we just don't notice because many interactive services are TCP-based and the lost packets get retransmitted automatically. In the above cases where some SNMP packets are lost but traffic is flowing, assuming zero is the wrong thing to do - you end up with a graph that looks like it's missing teeth whenever the link fills up. MRTG interpolates the lost data to produce a smoother graph which is more accurate in cases of intermittent packet loss. But with V2.8.4 and above, you can use the "unknaszero" option to produce whichever graph is best under the conditions typical for your network. AUTHOR
Tobias Oetiker <tobi@oetiker.ch> 2.17.4 2012-01-12 MRTG-FAQ(1)
All times are GMT -4. The time now is 09:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy