Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: yifangt
Forum: Programming 01-17-2020
7,797
Posted By GRMartin
rpath is actually a linker option rather then a...
rpath is actually a linker option rather then a compiler option. gcc passes it to ld.



Well, th estandard way to use shared objects (.so) is to install them in the system directories used for...
Forum: Programming 01-15-2020
7,797
Posted By GRMartin
No. Each folder requires a -L entry. ...
No. Each folder requires a -L entry.






I presumed htslib-1.10-2 was your library. The -l option is for the library itself. If the library is libhts.so then use -lhts





I'll have a...
Forum: Programming 01-15-2020
7,797
Posted By GRMartin
Undefined references means the compiler can't...
Undefined references means the compiler can't find compiled code for functions being called. If you want to use a subset of the library then you'll have to compile and link all the files used by the...
Forum: Programming 01-15-2020
7,797
Posted By Neo
First, I suggest when troubleshooting, you...
First, I suggest when troubleshooting, you should:

Use the full path name to file, not relative path name. This will insure there are no strange, unseen PATH issues. For example:

gcc -Wall...
Forum: Programming 11-12-2019
10,343
Posted By DevuanFan
Thank you, Jim. That's a great tutorial. In...
Thank you, Jim. That's a great tutorial.

In case this helps other newbies, I moved the getstring function to a separate file containing custom functions. Also, I changed getstring's logic to go...
Forum: Programming 11-11-2019
10,343
Posted By apmcd47
realloc() is not guaranteed to reallocate in...
realloc() is not guaranteed to reallocate in situ, which is why you do
str = realloc(str, mem); rather than realloc(str, mem); The next_read variable should be reset with something like next_read =...
Forum: Programming 11-07-2019
9,915
Posted By MadeInGermany
BTW in many cases a trim function comes in handy....
BTW in many cases a trim function comes in handy.
For example, the fuzzy strstr() that can match a portion of the string can be replaced with an exact strcmp()
...
//...
Forum: Programming 11-07-2019
9,915
Posted By MadeInGermany
The empty line prints str1. Because it was not...
The empty line prints str1.
Because it was not matched in scanf() it has the value from the previous line - therefore the str1= assignment,
should set it to "" with one of
str1[0]=0 or...
Forum: Programming 11-05-2019
9,915
Posted By MadeInGermany
The str1 variable is too small. "sample10" is 8...
The str1 variable is too small. "sample10" is 8 characters, so str1 must have 8+1=9 bytes wide at least.
char name[256]; //1st part (key part) parsed from each line[]
char str1[12]; ...
Forum: Programming 11-04-2019
9,915
Posted By MadeInGermany
The code that you provided stops at line 8 with...
The code that you provided stops at line 8 with exit 1:
...
printf("%s: %s\n", name, str1); //puts() always adds newline at the end of the string
//printf("%d\n", i);
...
Forum: Programming 11-04-2019
9,915
Posted By MadeInGermany
For me it works: the red phrases land in the blue...
For me it works: the red phrases land in the blue variables.
But there can be trailing spaces in name because %[^:] matches up to the :
3,616
Posted By Don Cragun
1) It looks like vgersh99 has already shown you...
1) It looks like vgersh99 has already shown you how to expand shell variables for use in awk. Note, however, that his code will append to your two output files; not replace them if they already...
3,616
Posted By vgersh99
MY_DIR="/storage/tmp" awk -v myDir="${MY_DIR}"...
MY_DIR="/storage/tmp"
awk -v myDir="${MY_DIR}" '{if ($1 == "aaa") out=(myDir "/group_a.gtf"); else if ($7 == "bbb") out=(myDir "/group_b.gtf"); print >> out;close(out)} ' infile
2,633
Posted By Scrutinizer
awk version you could try: awk 'BEGIN{FS=RS;...
awk version you could try:
awk 'BEGIN{FS=RS; RS=">"; ORS=""} FNR>1{A[$1]=RS $0} END{for(i in A) print A[i]}' file1 file2

note: ensure that there are no excess trailing spaces as is the case with...
2,633
Posted By RudiC
May I paraphrase your request: You want file2's...
May I paraphrase your request: You want file2's sequences to prevail and file1's sequences inserted only if there's no equivalent in file2. If so, try
tr $'\n>' $' \n' <file1| grep -vf <(sed -n...
2,633
Posted By vgersh99
not sure if I follow your samples and the desired...
not sure if I follow your samples and the desired output, but I think you might want this.

awk -f dinesh.awk file2 file1 where dinesh.awk is:

FNR==NR {
if (FNR%2)
head=$0
else
...
1,181
Posted By Corona688
Parallel is not a go-faster button for files. ...
Parallel is not a go-faster button for files. Unless your CPU is maxing out, there's no benefit.

GNU parallel is just doing individual files like you were doing anyway. It has to, lacking magic...
1,181
Posted By bakunin
Actually this is a very interesting problem. It...
Actually this is a very interesting problem. It is hard simulate without actually create some terabytes of files that are similar in size to what you have to process, therefore, before i start to...
1,181
Posted By Don Cragun
How about something more like: ...
How about something more like:
LIST1=/what/ever/you/want
OUTPUT1=raw_reads_count.table1

while read -r f
do ( linecount=$(zcat ${f}_R1.fq.gz | wc -l)
printf '%s\t%s\n' "$f" "$linecount" >>...
1,181
Posted By RudiC
How about { echo -n $f" "; zcat ${f}_R1.fq.gz...
How about
{ echo -n $f" "; zcat ${f}_R1.fq.gz | wc -l; } >> raw_reads_count.table1 &
Should that fail, write to single files in sequence, then, after the loop, concatenate the files.
625
Posted By Corona688
Buffering will make a mess of this, bundling...
Buffering will make a mess of this, bundling arbitrary blocks into one write. These arbitrary blocks don't care much where lines begin and end. Long enough lines could conceivably take more than...
Forum: Programming 07-16-2018
1,142
Posted By Corona688
The risk of strcpy is this: char buf[8]; //...
The risk of strcpy is this:

char buf[8]; // Only room for 8 characters
char very_important_variable_touch_and_the_world_explodes=42;

// More than 8 characters, where does the rest go?...
Forum: Programming 07-16-2018
1,142
Posted By Corona688
Stop that! That's not how you use strncpy! And...
Stop that! That's not how you use strncpy! And also not why people use it.

Blindly using strncpy because people call strcpy "bad" is worse than just using strcpy in the first place. You are not...
Forum: Programming 07-13-2018
1,142
Posted By jim mcnamara
You are depending on the existence of a...
You are depending on the existence of a terminating NUL. You write 128 total and leave no room in the shorter string str1. You leave no terminating NUL. strcpy printf and lots of other functions...
Forum: Programming 07-12-2018
1,142
Posted By Corona688
None of these do anything weird with newlines at...
None of these do anything weird with newlines at all.

Blindly using anything without knowing what it's for or what it does will cause problems, as it has here. strcpy would have worked.


...
Showing results 1 to 25 of 356

 

Featured Tech Videos

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