2018-10-21         Paula

Why do programs in Unix-like environments have numbers after their name?

This question already has an answer here: What does the number in parentheses shown after Unix command names in manpages mean? 6 answers It's the man page section. From memory, section 1 is user programs, 2 is system calls, and 3 is standard C library calls, and 5 is file formats.Wikipedia has the full explanation here. [XXX]That's the man page section number. For example man printf(should) Give you section 1, printf the bash command, while man 3 printfgives you the C function prin...

 unix                     2 answers                     79 view
 2018-10-21         Burnell

How can you untar more than one file at a time?

I have a bunch of tar files in a directory and I want to extract all the files from them at once. But this doesn't seem to do anything:$ tar xf *.tarWhat's going on here? How do I untar a bunch of files at once? What's going on here?Originally, the tar command was intended for use with magnetic tape devices. Since it only made sense to execute tar on one device at a time, the syntax was designed to assume one and only one device. The first file or directory passed was assumed to be the device that held the archive in question and any other files or directories where ...

 unix                     3 answers                     81 view
 2018-10-21         Bill

With Unix find(1), how do I find files in one tree newer than counterparts in another tree?

Let's say I have two directory structures:/var/www/site1.prod/var/www/site1.testI want to use find(1) to see the files that are newer in /var/www/site1.test than their counterparts in /var/www/site1.prod.Can I do this with find(1), and if so, how? I think you can't do it with find alone, but you can do something like$ cd /var/www/site1.test$ files=`find .`$ for $f in $files; do if [ $f -nt /var/www/site1.prod/$f ]; then echo "$f changed!"; fi; done [XXX]You also could use rsync -nrsync -av -n /var/www/site1.test /var/www/site1.prodshould do it. [XXX]Using find...

 unix                     5 answers                     83 view
 2018-10-21         William

Check file size in shell and display file and path above a threshold

I am trying to check for files which are larger than a given threshold. I know that the 'du' comand gives me the output for each file/folder, but how to put that in a single line on shell (using awk with if clause?). find with -size parameter. Prepending + will yield all files of equal or greater size. For example to find all files of at least 10MB in current directory:find . -size +10M [XXX]

 unix                     1 answers                     84 view
 2018-10-21         Arthur

Need help to print

i have a .txt file with following rowsError code:JOB ID- ABCDE30401 Adapter-Error code:JOB ID- ABCDE30397 Adapter-Error code:JOB ID- ABCDE30402 Adapter-Error code:JOB ID- ABCDE30398 Adapter-Error code:JOB ID- ABCDE30399 Adapter-Error code:JOB ID- ABCDE30396 Adapter-Error code:JOB ID- ABCDE30400 Adapter-Error code:JOB ID- ABCDE30403 Adapter-Error code:JOB ID- ABCDE30395 Adapter-Error code:JOB ID- BCDEH9009001 Adapter- Error code:JOB ID- ABCDE31761 Adapter-Error code:JOB ID- ABCDE31853 Adapter-Error code:JOB ID- ABCDE31852 Adapter-Error code:JOB ID- JKLMN41818 Adapter-Error c...

 unix                     1 answers                     88 view
 2018-10-21         Oliver

using awk to do left outer join kinda sql on files in unix

I'm trying to do a join based on the 1st columns present in both the files.So far I have tried using is the below codeawk '{if (NR==FNR) {a[$1]=$2; next} if ($1 in a) {print $2"|"$3"|""Found"} if(!($1 in a)) {print $2"|"$3"|""Not Found"}}' file1.txt file2.txt > TARGET.txtfile1 file contents1as.pdf2as.pdf3as.pdf45.pdfas.pdffile2 file contents3ss.pdf 1_2_3_45.csv 43s.pdf 1_2_3_45.csv 42as.pdf 1_2_3_45.csv 41as.pdf 1_2_3_45.csv 445.pdf 1_2_3_45_5.csv 13.pdf 1_2_3_5.csv 1 $ awk -v OFS='|' 'NR==FNR{a[$1];next} {print $2,$3,((...

 unix                     1 answers                     89 view
 2018-10-21         Harriet

Using awk on all columns for just part of column content

I trying to find a solution for the following. I have a list of gene IDs in my first column and in all the other columns the related GO terms. The number of columns behind each gene ID is therefor variable. As follows the first few lines:TRINITY_DN173118_c0_g1 GO:0000139^cellular_component^Golgi membraneTRINITY_DN49436_c2_g1 GO:0006351^biological_process^transcription, DNA-templatedTRINITY_DN47442_c0_g1 GO:0003677^molecular_function^DNA binding GO:0006302^biological_process^double-strand break repair GO:0006310^biological_process^DNA recombinationThe GO terms are ...

 unix                     2 answers                     92 view
 2018-10-21         Aaron

Split large file into smaller files with certain number of records (awk, unix)

I'm trying to split a large file (>30,000 records) into multiple files each containing <= 4000 records. I think awk might be the way to go on this.Example file:proteins.txt >gi|1000108|gb|AAA92500| melatonin receptor [Xenopus laevis] hsswynrlfsnsgticyvglvwvlalgailpnlfvgslrcdprifsctfaqyvssyytiavvifhfflpigvvsycylriwvlvlnirhrvkpdrhlhhqtwpynihgfitmfvvfvlfavcwgplniigltvaiypplgdsipqwlfvasyf >gi|1000110|gb|AAA92501| melatonin receptor [Xenopus laevis] hsfvyeklfslwntilyvcliwtltvvatvpnffvgsleydpriysctfvqtvsssytitvvvihfilpitvvtfcylriwilviqvrrkvksefkprmkqsdfrnfltm...

 unix                     2 answers                     97 view
 2018-10-21         Justin

sed to replace pattern in second column for multiple times

New to sed and trying to get the following done, but completely stuck:I am trying to replace a pattern with sed in the second column. This pattern is occuring multiple times.I have:Gene1 GO:0000045^biological_process^autophagosome assembly`GO:0005737^cellular_component^cytoplasmGene2 GO:0000030^molecular_function^mannosyltransferase activity`GO:0006493^biological_process^protein O-linked glycosylation`GO:0016020^cellular_component^membraneI want to get:Gene1 GO:0000045,GO:0005737Gene2 GO:0000030,GO:0006493,GO:0016020So getting rid of all the descriptive parts and use "," as...

 unix                     3 answers                     99 view
 2018-10-21         Lynn

bash append text at the start and end of ls output

I want to change the output of ls from:1.png2.png3.pngInto Start [1.png] EndStart [2.png] EndStart [3.png] EndI need to append a string at the start and end of a line at the same time.I'm not opposed to using text files to store the output however I avoid it if there is a better way.I know I can usels | sed 's/^/Start [/'andls | sed 's/$/] End/'However is there a way to combine these 2 operations into 1 statement? And avoid using temporary text files? Using sed: sed 's/^/start [ /;s/$/ ] end/' start [ 1.png ] endstart [ 2.png ] endstart [ 3.png ] end [XXX]Could you p...

 unix                     4 answers                     99 view
 2018-10-21         Byron

How to search for a pattern in a file from the end of a directory using grep?

I need to search for files containing a pattern in a directory (to search from the end of the directory to the start). This is the command I use now, grep -rl 'pattern'Is there any command to search for a pattern from the last file of a directory to the first file? If you want to grep to search in some order, you need to pass it a list of file names in the order you want. If you want the files in the current directory in reverse order of name, ls -r would do the job. How about something like this?ls -1br | xargs grep 'pattern'Note the -b, which is needed to mitigate pro...

 unix                     1 answers                     104 view
 2018-10-21         Astrid

find -exec with parameters in groovy

I have a pipeline in Jenkins that calls a groovy script which does some important stuff and after its finished doing that stuff it runs a shell command which is supposed to run another shell script.script { sh "git config --global user.name 'Jenkins'; git config --global user.email 'someone@email.com'; echo ${params.SELECTED_TEMPLATES} > selected_templates.cfg; find /var/lib/jenkins/workspace -name 'execute-test.sh' -type f -exec chmod 755 {} ';' -exec ${SF_USERNAME} ${SF_PASSWORD} {} ';'" }Log:find: missing argument t...

 unix                     1 answers                     11 view
 2018-10-21         Winifred

How to download ports OpenBSD

How to extract the ports, src, sys trees to /user/ports, /usr/src, usr/src/sys in OpenBSD. Command to do the download and the untar. Check the PortsFetch section of the faq: Once you have decided which flavor of the ports tree you want, you can get it from different sources. The table below gives an overview of where you can find the different flavors, and in which form. An 'o' marks availability and '-' means it is not available through that specific source.Look for a file named ports.tar.gz on the mirrors.$ cd /tmp$ ftp https://ftp.openbsd.org/pub/OpenBSD/$(uname -r)...

 unix                     1 answers                     45 view
 2018-10-22         Arlene

Unix: ls to select all files, but in a random order?

Since ls returns the files in alphabetical order, is there a way to return the same files but in a random order? I am trying to loop through all the files in a directory, but would like it to differ in separate runs.for i in *.py # Would like order to be randomdo ...done This is a duplicate of randomly shuffling files in bash and How can I shuffle the lines of a text file on the Unix command line or in a shell script?However, this should do the job:for i in `ls *.py | shuf`do echo $idone [XXX]

 unix                     1 answers                     33 view
 2018-10-22         Arthur

What is the difference between a .sl and a .so on HPUX?

Since you can link your application to a .sl file and a .so file what exactly are the differences between .so and .sl files? After a quick googling, I found this.*.so shared libraries are used in HP-UX 11.20 and upwards. *.sl are used in PA-RISC (11.11) Basically, *.so files reside in /usr/lib/hpux32 and /usr/lib/hpux64/ on Itanium. *.sl resides in /usr/lib [XXX]

 unix                     1 answers                     93 view
 2018-10-22         Spring

How to Use session logs as a source and extract the session stats and load it to the DB

I need to capture session level details in a table. i have 150 workflows for which i need to maintain an audit table which will have info like session start time, session end time, applied rows, rejected rows etc. i can not use workflow variables using assignment task method because i need a reusable solution since i have 150 workflows. i tried using Post Session Success Command Task with built in variables as $PM@TableName etc.But there is no built in varible to capture the session start time and end time.Last option i thought that could help is extract stats from session ...

 unix                     1 answers                     63 view

Page 1 of 60  |  Show More Pages:  Top Prev Next Last