awk does not run inside your shell, hence cannot set shell variables. If you want to get a value out of awk, you have to print it somehow. Since you're already using stdout for data, maybe stderr?
Hi,
Does anyone know if it is possible to override the GID which files have when they are created in a specific folder?
I want the given GID for the folder to apply to the new files created in the folder, no matter what group the owner of the files have...
I have tried sticky bits but doesn't... (1 Reply)
help trying to figure out a batch shell script to zip each file in a directory into its own zip file
using this code but it does not work
tryed this also
nothing seems to work , just ends without zipping any files
i have over 3000 files i need to zip up individualy
... (7 Replies)
I have say 100 text files (with .txt extension) in a directory.
An example of the content in the file is given below
"NAME"
"cgd1_200"
"cgd1_3210"
"cgd1_560"
"cgd2_2760"
"cgd2_290"
"cgd3_3210"
"cgd3_3310"
"cgd3_660"
"cgd5_2130"
"cgd5_4080"
"cgd6_3690"
"cgd6_4480"
"cgd8_1540"... (2 Replies)
Hi,
I have a bunch of records within a directory where each one has this form:
(example file1)
1 2 50 90 80 90 43512 98 0909 79869 -9 7878 33222 8787 9090 89898 7878 8989 7878 6767 89 89 78676 9898 000 7878 5656 5454 5454
and i want for all of these files to be... (3 Replies)
Hi,
I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files.
To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Hey gyuz,
I wanna calculate the number of mapped reads of a bam file in a region of interest. I used this code to do so :
samtools view input.bam chrname:region1 > region1.txt
This will store all the reads from given bam file within the region of interest in region1.txt
Now I have... (5 Replies)
Hi all:
i need to run a rather simple command-line argument:
head -200 input > output
However, I need to do it on several files, all in the same directory.
Is this possible? (2 Replies)
I am trying to apply an awk action over multiple files in a directory. It is a simple action, I want to print out the 1st 2 columns (i.e. $1 and $2) in each tab-separated document and output the result in a new file *.pp
This is the awk that I have come up with so far, which is not giving me a... (6 Replies)
I am trying to merge the below awk, which compares two files looking for a match in $2 and then prints the line if two conditions are meet.
awk
awk 'FNR==NR{A=$0;next} ($2 in A){if($10>30 && $11>49){print A}}' F113.txt F113_tvc.bed
This code was improved and provided by @RavinderSingh13,... (18 Replies)
Hi all!
I have this command
grep -E '^\To: |^\Date: |^\Subject: ' fileA.txt > fileA_1.txt && grep -v '^\To: |^\Date: |^\Subject: ' fileA.txt >> fileA_1.txt && rm fileA.txt && sed -i -e 's/\(Date: \|Subject: \|To: \)//g' fileA_1.txtHow do I apply it to all the files in the folder (each file has a... (7 Replies)
Discussion started by: guilliber
7 Replies
LEARN ABOUT BSD
apply
APPLY(1) General Commands Manual APPLY(1)NAME
apply - apply a command to a set of arguments
SYNOPSIS
apply [ -ac ] [ -n ] command args ...
DESCRIPTION
Apply runs the named command on each argument arg in turn. Normally arguments are chosen singly; the optional number n specifies the num-
ber of arguments to be passed to command. If n is zero, command is run without arguments once for each arg. Character sequences of the
form %d in command, where d is a digit from 1 to 9, are replaced by the d'th following unused arg. If any such sequences occur, n is
ignored, and the number of arguments passed to command is the maximum value of d in command. The character `%' may be changed by the -a
option.
Examples:
apply echo *
is similar to ls(1);
apply -2 cmp a1 b1 a2 b2 ...
compares the `a' files to the `b' files;
apply -0 who 1 2 3 4 5
runs who(1) 5 times; and
apply 'ln %1 /usr/joe' *
links all files in the current directory to the directory /usr/joe.
SEE ALSO sh(1)AUTHOR
Rob Pike
BUGS
Shell metacharacters in command may have bizarre effects; it is best to enclose complicated commands in single quotes ' '.
There is no way to pass a literal `%2' if `%' is the argument expansion character.
4.2 Berkeley Distribution April 29, 1985 APPLY(1)