unix

How to concatenate files that have the same beginning of a name?

旧时模样 提交于 2021-01-27 10:46:00
问题 I have a directory with a few hundred *.fasta files, such as: Bonobo_sp._str01_ABC784267_CDE789456.fasta Homo_sapiens_cc21_ABC897867_CDE456789.fasta Homo_sapiens_cc21_ABC893673_CDE753672.fasta Gorilla_gorilla_ghjk6789_ABC736522_CDE789456.fasta Gorilla_gorilla_ghjk6789_ABC627190_CDE891345.fasta Gorilla_gorilla_ghjk6789_ABC117190_CDE661345.fasta etc. I want to concatenate files that belong to the same species, so in this case Homo_sapiens_cc21 and Gorilla_gorilla_ghjk6789. Almost every species

How to concatenate files that have the same beginning of a name?

别说谁变了你拦得住时间么 提交于 2021-01-27 10:43:22
问题 I have a directory with a few hundred *.fasta files, such as: Bonobo_sp._str01_ABC784267_CDE789456.fasta Homo_sapiens_cc21_ABC897867_CDE456789.fasta Homo_sapiens_cc21_ABC893673_CDE753672.fasta Gorilla_gorilla_ghjk6789_ABC736522_CDE789456.fasta Gorilla_gorilla_ghjk6789_ABC627190_CDE891345.fasta Gorilla_gorilla_ghjk6789_ABC117190_CDE661345.fasta etc. I want to concatenate files that belong to the same species, so in this case Homo_sapiens_cc21 and Gorilla_gorilla_ghjk6789. Almost every species

Using grep to find string with brackets

旧巷老猫 提交于 2021-01-27 02:37:09
问题 I have some problems with the grep command. I have the following two files in my folder: test.dat: fdf bla(fd_bla_bla) =& bdf bla test2.dat fd fd fij d bla(fdf) fdjk bla Now I search for the bla having brackets after it with grep 'bla(*)' * but it just gives me the entry of the first file...Do you have an idea why? 回答1: You need regular expressions to do that match. egrep "bla\(.*\)" *.dat will give the correct result. 回答2: your grep 'bla(*)' * won't work, because it looks for bla) or bla((((

Using grep to find string with brackets

谁说我不能喝 提交于 2021-01-27 02:36:59
问题 I have some problems with the grep command. I have the following two files in my folder: test.dat: fdf bla(fd_bla_bla) =& bdf bla test2.dat fd fd fij d bla(fdf) fdjk bla Now I search for the bla having brackets after it with grep 'bla(*)' * but it just gives me the entry of the first file...Do you have an idea why? 回答1: You need regular expressions to do that match. egrep "bla\(.*\)" *.dat will give the correct result. 回答2: your grep 'bla(*)' * won't work, because it looks for bla) or bla((((

Using grep to find string with brackets

北战南征 提交于 2021-01-27 02:36:19
问题 I have some problems with the grep command. I have the following two files in my folder: test.dat: fdf bla(fd_bla_bla) =& bdf bla test2.dat fd fd fij d bla(fdf) fdjk bla Now I search for the bla having brackets after it with grep 'bla(*)' * but it just gives me the entry of the first file...Do you have an idea why? 回答1: You need regular expressions to do that match. egrep "bla\(.*\)" *.dat will give the correct result. 回答2: your grep 'bla(*)' * won't work, because it looks for bla) or bla((((

Can two Unix processes simultaneous write to different positions in a single file?

耗尽温柔 提交于 2021-01-24 11:49:05
问题 This is an unresolved exam question of mine. Can two Unix processes simultaneous write to different positions in a single file? Yes, the two processes will have their own file table entries no, the shared i-node contains a single offset pointer only one process will have write privilege yes, but only if we operate using NFS 回答1: There is no file offset recorded in an inode so answer 2. is incorrect. There is no documented reason for a process to have its access rights modified so 3. is

is there a way to use the equivalent of touch in powershell to update time stamps of a file?

瘦欲@ 提交于 2021-01-24 07:16:37
问题 I use the unix command 'touch' a lot to update time-stamps of any new acquired/downloaded file in my system. Many a times the time-stamp of the existing file is old so it can get lost in the system. Is there a way in MS-Windows powershell to do so. I have both powershell 5 as well as powershell 6. 回答1: You can use $file = Get-Item C:\Intel\Logs\IntelCpHDCPSvc.log $file.LastWriteTime = (Get-Date) Or CreationTime or LastAcccessTime, if you prefer. As a function Function

jq sorts KEY and VALUES in different way - how can I enumerate them in the same order?

China☆狼群 提交于 2021-01-21 04:39:27
问题 I get REST output in JSON format using curl command as below Getting KEY names alone using: curl http://test.te:8080/testApp/app/version | jq '.version' | jq '. | keys' OUTPUT: "Archiver-Version", "Build-Id", "Build-Jdk", "Build-Number", "Build-Tag", "Built-By" Getting VALUES alone using: curl http://test.te.com:8080/testApp/app/version | jq '.version' | jq '.[]' OUTPUT (Note how the order of values doesn't correspond to the order of key names; e.g., the first value, "user@test.com" , is the

Pass command line arguments via sbatch

懵懂的女人 提交于 2021-01-20 14:43:48
问题 Suppose that I have the following simple bash script which I want to submit to a batch server through SLURM: #!/bin/bash #SBATCH -o "outFile"$1".txt" #SBATCH -e "errFile"$1".txt" hostname exit 0 In this script, I simply want to write the output of hostname on a textfile whose full name I control via the command-line, like so: login-2:jobs$ sbatch -D `pwd` exampleJob.sh 1 Submitted batch job 203775 Unfortunately, it seems that my last command-line argument (1) is not parsed through sbatch,

Trying to remove non-printable charaters(junk values) from a UNIX file

蓝咒 提交于 2021-01-20 04:18:50
问题 I am trying to remove non-printable character (for e.g. ^@ ) from records in my file. Since the volume to records is too big in the file using cat is not an option as the loop is taking too much time. I tried using sed -i 's/[^@a-zA-Z 0-9`~!@#$%^&*()_+\[\]\\{}|;'\'':",.\/<>?]//g' FILENAME but still the ^@ characters are not removed. Also I tried using awk '{ sub("[^a-zA-Z0-9\"!@#$%^&*|_\[](){}", ""); print } FILENAME > NEW FILE but it also did not help. Can anybody suggest some alternative