Tag Info

New answers tagged

2

You can use this if you are on a little endian system: iconv -f utf-8 -t ucs-4le | od -tx4 or this if you are on a big endian system: iconv -f utf-8 -t ucs-4be | od -tx4


2

enscript just does not support Unicode. You need to use a different tool such as paps to convert text to PostScript. With --header option an output .pdf is similar to one produced with enscript: $ paps text --header | ps2pdf - outheader.pdf


0

When you call your script you need to enclose the given string. Say your script is called parse.sh then you should call it using: ./parse.sh "test & test" or ./parse.sh 'test & test" If you call the script using: ./parse.sh test & test the shell will try to execute ./parse.sh test in the background and run test as next command. See ...


0

As @Kevin suggested, you can use wc command to count lines in a file. However, wc -l test.txt will include the file name in the result. You can use: wc -l < test.txt to just get the number of lines without file name in it. Give it a try.


1

An awk solution: awk '!a[$0]++'


0

Tip: Use database tools for database work. If you end up spending all of your time just working out the mechanics of looking things up as opposed to doing the lookups themselves, and your commands to look things up are long combinations of perl, sed, awk, and grep that start to resemble modem line noise, then it is time to consider using actual database ...


0

#!/bin/bash while read line do grep -A 1 $line filea >> filec done < fileb


2

In the simplest case, where you just want any line that contains "u", you can do grep '"u"' a > b If you want to make sure it only matches in the description field of your gff file (assuming this is a properly formatted gff file with tab-separated fields), you can do: awk -F"\t" '$NF~/"u"/' a > b Finally, if you are only interested in cases where ...


1

grep "\"u\";" a >b will also do the job.


1

Or grep for class_code "u": grep 'class_code "u"' input


2

Using awk you can match column 22 using awk '$22=="\"u\";"' a


2

You can use this: awk '$22 ~ /\"u\";/' file If there is variable number of fields as mentioned in comments and class_code precedes required field this could be helpful: awk '{ for (i = 1; i <= NF; i++) { if ($i ~ /class_code/) { if ($(i+1) ~ /\"u\";/) { print $0; break; } } } }' file


3

grep -fB A will do what you're looking for; the -foption specifies a file from which patterns are loaded, one pattern per line. Any line in A which matches a pattern in B will be output.



Top 50 recent answers are included