Sponsored Content
Top Forums Shell Programming and Scripting Bash script jumping too quickly to the next command - crash Post 302973542 by tremblayemilie9 on Wednesday 18th of May 2016 01:50:29 PM
Old 05-18-2016
Linux

Hi,
the last step to work correctly is:

Code:
for f in $(find "$trimmed" -type f | grep -F ".fasta" | grep -v -F ".scrap.fasta") # -v -> exclude
do
  sed -i 's/%[^:]*//' "$f"
done



Then, the next step which is the issue from is that;

Code:
custom=$(echo "${customFields[@]}" | sed -e 's/ /\\t/g') #add custom
echo -e "#SampleID\tBarcodeSequence\tLinkerPrimerSequence\tInputFileName\t"${custom}"\tDescription" > "${metadata}"/metadata.tsv

for g in $(find "$trimmed" -type f | grep "fasta" | grep -v "scrap") # -v -> exclude
do
  name=$(basename "$g")
  nameNoExt="${name%.*}"
  #create array: a=(1 2 3 4)
  #show content of array: echo "${a[@]}"
  #t="${nameNoExt//-/ }"
  #params=("${nameNoExt//-/ }") #${string//substring/replacement}
  #echo "${params[@]}"
  param1=$(cut <<< "$nameNoExt" -d "-" -f 1) #equals $(echo "$nameNoExt" | cut -d "-" -f 1)
  param2=$(cut <<< "$nameNoExt" -d "-" -f 2)
  param3=$(cut <<< "$nameNoExt" -d "-" -f 3 | sed -e 's/Run//') #only keep the number of the run

  tempLine=$(cat "$barcode" | grep "$param1" | grep "$param2" | grep "$param3")
  echo "$tempLine" | awk -v fileName="$name" -v sampleName="$its" -F $'\t' 'BEGIN {OFS = FS} {print $1, $3, $4, fileName, $6, $7, $8, $9, $10, $1"-"sampleName}' >> "${metadata}/metadata.tsv"
done





Thanks a lot Smilie

Last edited by vgersh99; 05-18-2016 at 02:58 PM.. Reason: too early for the christmas trees - please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux Os Crash Script

How can I simulate a Linux OS crash without damaging the OS? I am performing an os watchdog test that sends out an alert once the timer expires. (1 Reply)
Discussion started by: cstovall
1 Replies

2. Shell Programming and Scripting

script to loop and check jumping seq.

Hi, Normally, I will manually to use "ll" command to list the following file from \FILE\CACHE\ directory and check the jump seq. Can I write a script to loop or/and check jump seq file (if jumped seq and show "missing seq no" message for me) -rw-rw----+ 1 user develop 14012 Sep 4... (1 Reply)
Discussion started by: happyv
1 Replies

3. UNIX for Dummies Questions & Answers

need solution for this quickly. please quickly.

Write a nawk script that will produce the following report: ***FIRST QUARTERLY REPORT*** ***CAMPAIGN 2004 CONTRIBUTIONS*** ------------------------------------------------------------------------- NAME PHONE Jan | ... (5 Replies)
Discussion started by: p.palakj.shah
5 Replies

4. Shell Programming and Scripting

work area directory jumping script?

hi all, Ive been trying to find some way of doing this for ages but i have is a shell script that activates a python search and there it no tab completion. more familliar with tcsh at the moment but i'm a newbe. i was trying to make an easy way to browse to a list of working directories. ... (0 Replies)
Discussion started by: jvan
0 Replies

5. Shell Programming and Scripting

Piping output from a command into bash script

Hi all. I am using procmail to deliver an email to a script I am developing. Procmail delivers the email to the script on standard input. I imagine this is the same as piping input from a command into the script. Hence I've been testing my script by running echo 'test' | sms-autosend-backup.sh ... (2 Replies)
Discussion started by: akindo
2 Replies

6. Solaris

jumping from one line to another

Hi, Thanks (10 Replies)
Discussion started by: rocky1954
10 Replies

7. Shell Programming and Scripting

BASH SCRIPT of LS command

I need help in writing a BASH SCRIPT of ls command. for example: $ ./do_ls.sh files f1.txt f2.jpeg f3.doc $ ./do_ls.sh dirs folder1 folder2 folder3 My attempt: #!/bin/bash # if test $# -d file then echo $dirs else (3 Replies)
Discussion started by: above8k
3 Replies

8. Shell Programming and Scripting

How to ignore error in command in bash script?

Hello, i have bash script where im cycling some command for different lines in external file. example: while read domain;do nslookupout=$(nslookup -type=ns $domain) || true another commands done < filenamewithdomains i added: || true after the command in belief it will just skip... (6 Replies)
Discussion started by: postcd
6 Replies

9. Shell Programming and Scripting

New bash menu printing errors but closes too quickly

I am beginning to write a new version of the bash menu below. The previous version worked great and now when I start the updated bash it opens and a some lines print in the terminal and it closes quickly. I know there are errors but how can I see them or fix them, I tried set -x with the same... (12 Replies)
Discussion started by: cmccabe
12 Replies

10. Shell Programming and Scripting

Need bash script to use a sed command as a variable

I need to be able to use a sed command as a variable in a bash script. I have the sed command that almost works the way I want it. the command is sed -n '/inet/,/}/p' config.boot This gets me this result: inet 192.168.1.245 } I need to get the IP address into a variable so I... (9 Replies)
Discussion started by: edlentz
9 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 02:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy