Search Results

Search: Posts Made By: cmccabe
577
Posted By nezabudka
We are confused. As I understand it, all this is...
We are confused. As I understand it, all this is superfluous.
You just need to include the config in start of the script and that's it.
. $1
After this expression, your config will virtually be...
577
Posted By nezabudka
config=$1 echo "$@" while read line; do ...
config=$1

echo "$@"
while read line; do
echo "$line"
done <"$config" >other_file
577
Posted By nezabudka
In the script, it is better to immediately...
In the script, it is better to immediately indicate the path to the file.
. /path/to/config
You can also add a default value if a file is not specified at startup
. ${1:-/path/to/config}

---...
577
Posted By nezabudka
I made a mistake in the expression echo -e '....
I made a mistake in the expression echo -e '. $1\necho var' >script.sh
I fixed it and you probably just copied it before that :)
It will be right echo -e '. $1\necho $var' >script.sh

--- Post...
577
Posted By nezabudka
Hi Try to find out mkdir TEST && cd $_ echo...
Hi
Try to find out
mkdir TEST && cd $_
echo -e '. $1\necho $var' >script.sh
echo 'var=yes' >config
bash script.sh config
yes
843
Posted By RudiC
Even if the file is moved between file systems,...
Even if the file is moved between file systems, there should not be a problem as long as the file is kept open. Even though the file and it's contents ARE moved by the mv command, the OS keeps the...
843
Posted By Scrutinizer
Hi Ravinder, As long as a mv operation is...
Hi Ravinder,

As long as a mv operation is performed on the same file system - as is the case here - that should not pose a problem, since mv then only manipulates directory data: A file name is...
843
Posted By nezabudka
Hi and thanks No, you can see what will happen ...
Hi and thanks
No, you can see what will happen
cat>>file.txt<<EOF
1
2
FORMAT new
3
4
EOF
cp file.txt file2.txt
ls
file.txt file2.txt
awk '/FORMAT/ {system("mv -n "FILENAME" "$2)}; {print...
843
Posted By RavinderSingh13
Hello nez, How are you? I hope you are...
Hello nez,

How are you?
I hope you are doing fine :)

For your this solution, if you ask me IMHO we could avoid using renaming of a Input_file with system while reading Input_file itself...
843
Posted By Scrutinizer
Note: -n (no clobber) for the mv command is...
Note: -n (no clobber) for the mv command is non-standard extension to the POSIX standard. Alternatively, try using -i for interactive use (but some systems ignore -i when used in a non-interactive...
843
Posted By nezabudka
I'm sorry, you should add a check for the...
I'm sorry, you should add a check for the existence of the file
awk '/FORMAT/ {system("mv -n "FILENAME" "$10)}' *.vcf
843
Posted By nezabudka
Hi Try this new=$(awk '/FORMAT/ {print $10}'...
Hi
Try this
new=$(awk '/FORMAT/ {print $10}' $f)
or
new=$(sed /FORMAT/!d;s/^.*\t//' $f)
if the file is large, it’s useful to add "quit" command
new=$(sed /FORMAT/!d;s/^.*\t//;q' $f)

--- Post...
911
Posted By RudiC
xargs is used to turn a stream on stdin into...
xargs is used to turn a stream on stdin into command line arguments / parameters. sh expects its commands on stdin. Try without xargs, like echo "..." | sh


Or, use your .py as the xargs' command...
911
Posted By jim mcnamara
(3,0) A parenthesis is a reserved symbol in...
(3,0) A parenthesis is a reserved symbol in bash, not a string.
"(3,0)" Try making it a string...
939
Posted By RudiC
Oh? Changing basic data again? Be aware...
Oh? Changing basic data again?


Be aware that a good, decent, stable, consistent specification helps everyone dealing with your request, saving time and efforts.


And, either of the three...
939
Posted By rbatte1
From my suggestion in post 5, I'm sure you can...
From my suggestion in post 5, I'm sure you can attempt to replace the sub-process on line 2 (the bit between $( and )) such that the output it creates uses a loop based on a counter to create the...
939
Posted By RudiC
That desired command is different from the one in...
That desired command is different from the one in post #1. What exactly and finally do you need?



Why the detour using $id in lieu of using the file names in the directory immediately?
939
Posted By rbatte1
Do you want something more like:printf --...
Do you want something more like:printf -- "/path/to/xxx.py \\\\\n%s\n\t--ref /path/to/file \\\\\n\t--run /path/to/data\n" \ # Set up the output format with fixed strings and an...
939
Posted By RudiC
Not sure I fully understand, and your "Tried"...
Not sure I fully understand, and your "Tried" block seems to be gobbledigook, but how about
while IFS="" read -r LN
do [ "$LN" = "${LN##*id}" ] && echo "$LN" || for FN in *.bam
...
867
Posted By RudiC
How far would this get you: awk '{TMP[$4]=$5;...
How far would this get you:
awk '{TMP[$4]=$5; VAL[$4]+=$7; CNT[$4]++} END {for (t in TMP) {i = t; gsub (/[:-]/, OFS, i); print i, TMP[t], VAL[t]/CNT[t]}}' OFS="\t" file
chr16 2097885 2097890 ...
891
Posted By nezabudka
Hi awk -F'Total Sequences[^0-9]*' '/Total...
Hi
awk -F'Total Sequences[^0-9]*' '/Total Sequences/ {sub("[^0-9].*", "", $2); print $2}'

--- Post updated at 23:03 ---

sed -n 's/.*Total Sequences[^0-9]*\([0-9]*\).*/\1/p' file

--- Post...
891
Posted By RudiC
Try also awk 'match ($0, /Total...
Try also
awk 'match ($0, /Total Sequences<\/td><td>[^<]*/) {print substr ($0, RSTART+24, RLENGTH-24)}' file
49531132
891
Posted By Scrutinizer
Try: awk '$2=="Total Sequences"{n=-3}...
Try:
awk '$2=="Total Sequences"{n=-3} ++n==0{print "$ts=" $2}' RS=\< FS=\> file
891
Posted By RudiC
Please take care when formulating your request....
Please take care when formulating your request. Misleading specifications may lead to unsatisfactory proposals.





Try
if ls "$dir"/[Ff]ile[Oo]ne.csv > /dev/null 2>&1
then echo "File...
891
Posted By MadeInGermany
Define a file_exists function...
Define a file_exists function (https://www.unix.com/shell-programming-and-scripting/252233-tip-file_exists-function.html).
Then you can do
if file_exists "$dir"/[Ff]ile[Oo]ne.csv
then
...
Showing results 1 to 25 of 500

 

Featured Tech Videos

All times are GMT -4. The time now is 08:19 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy