Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Loop awk command on files in a folder Post 302959830 by Yoda on Friday 6th of November 2015 10:23:21 AM
Old 11-06-2015
Try:-
Code:
awk -F'\t' 'FNR==1{ofile="NEW" FILENAME}$10=="S"{print > ofile}' *.subVCF

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using mv command for moving multiple files in a folder

Hi, I have a requirement where I need to move Bunch of folders containing multiple files to another archive location. i want to use mv command .I am thinking when we use mv command to move directory does it create directory 1st and then move all the files ? e.g source... (4 Replies)
Discussion started by: rkmbcbs
4 Replies

2. Shell Programming and Scripting

Comparison and editing of files using awk.(And also a possible bug in awk for loop?)

I have two files which I would like to compare and then manipulate in a way. File1: pictures.txt 1.1 1.3 dance.txt 1.2 1.4 treehouse.txt 1.3 1.5 File2: pictures.txt 1.5 ref2313 1.4 ref2345 1.3 ref5432 1.2 ref4244 dance.txt 1.6 ref2342 1.5 ref2352 1.4 ref0695 1.3 ref5738 1.2... (1 Reply)
Discussion started by: linuxkid
1 Replies

3. Shell Programming and Scripting

Loop through text file > Copy Folder > Edit XML files in bulk?

I have a text file which contains lines in this format - it contains 105 lines in total, but I'm just putting 4 here to keep it short: 58571,east_ppl_ppla_por 58788,east_pcy_hd_por 58704,east_pcy_ga_por 58697,east_pcy_pcybs_por It's called id_key.txt I have a sample folder called... (9 Replies)
Discussion started by: biscuitcreek
9 Replies

4. Shell Programming and Scripting

loop through files in each folder and perform sed

Dear all, I have few log folders in directory (FILE) and i need to perform sed on each files inside each folders. Here is my script, and i wish to rename each file back to the same file name after modification. Can anyone guide me on my script below? eg: folder1 contain files... (2 Replies)
Discussion started by: ymeyaw
2 Replies

5. UNIX for Dummies Questions & Answers

how to create a command that would print files only from 1 folder

Hi there how to create a command in csh that would print files only from 1 folder but as an argument takes home directory for e.g. in my home diecrtory I have 3 folders unix, windows,mac and alot of files. and I running the program as ./op ~ this should return me files from unix folder without... (1 Reply)
Discussion started by: FUTURE_EINSTEIN
1 Replies

6. Shell Programming and Scripting

For loop for number of files in a folder

Hi All, Need a for loop which should run for number of files in a folder and should pass the file name as parameter to another shell script for each loop. Please help me. Thanks. (2 Replies)
Discussion started by: chillblue
2 Replies

7. Shell Programming and Scripting

How to use a loop for multiple files in a folder to run awk command?

Dear folks I have two data set which there names are "final.map" and "1.geno" and look like this structures: final.map: gi|358485511|ref|NC_006088.3| 2044 gi|358485511|ref|NC_006088.3| 2048 gi|358485511|ref|NC_006088.3| 2187 gi|358485511|ref|NC_006088.3| 17654 ... (2 Replies)
Discussion started by: sajmar
2 Replies

8. Shell Programming and Scripting

awk error when increasing number of files in folder

I have a folder with several files of which I want to eliminate all of the terms that they have in common using `awk`. Here is the script that I have been using: awk ' FNR==1 { if (seen++) { firstPass = 0 outfile = FILENAME "_new" ... (4 Replies)
Discussion started by: owwow14
4 Replies

9. Shell Programming and Scripting

Apply command to all files in folder

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

10. UNIX for Beginners Questions & Answers

For loop to accept params and delete folder/files

Hi Folks - I'm trying to build a simple for loop to accept params and then delete the folder & files on the path older than 6 days. Here is what I have: Purge () { for _DIR in "$1" do find "${_DIR}"/* -mtime +0 -exec rm {} \; done } I would be passing... (4 Replies)
Discussion started by: SIMMS7400
4 Replies
SHTOOL-SCPP.TMP(1)					      GNU Portable Shell Tool						SHTOOL-SCPP.TMP(1)

NAME
shtool-scpp - GNU shtool C source file pre-processor SYNOPSIS
shtool scpp [-v|--verbose] [-p|--preserve] [-f|--filter filter] [-o|--output ofile] [-t|--template tfile] [-M|--mark mark] [-D|--define dname] [-C|--class cname] file [file ...] DESCRIPTION
This command is an additional ANSI C source file pre-processor for sharing cpp(1) code segments, internal variables and internal functions. The intention for this comes from writing libraries in ANSI C. Here a common shared internal header file is usually used for sharing information between the library source files. The operation is to parse special constructs in files, generate a few things out of these constructs and insert them at position mark in tfile by writing the output to ofile. Additionally the files are never touched or modified. Instead the constructs are removed later by the cpp(1) phase of the build process. The only prerequisite is that every file has a ``"#include ""ofile"""'' at the top. This command provides the following features: First it avoids namespace pollution and reduces prototyping efforts for internal symbols by recognizing functions and variables which are defined with the storage class identifier ``cname''. For instance if cname is ``intern'', a function ``"intern void *foobar(int quux)"'' in one of the files is translated into both a ``"#define foobar __foobar"'' and a ``"extern void *foobar(int quux);"'' in ofile. Additionally a global ``"#define" cname "/**/"'' is also created in ofile to let the compiler silently ignore this additional storage class identifier. Second, the library source files usually want to share "typedef"s, "#define"s, etc. over the source file boundaries. To achieve this one can either place this stuff manually into tfile or use the second feature of scpp: All code in files encapsulated with ``"#if "dname ... "#endif"'' is automatically copied to ofile. Additionally a global ``"#define" dname 0'' is also created in ofile to let the compiler silently skip this parts (because it was already found in the header). OPTIONS
The following command line options are available. -v, --verbose Display some processing information. -p, --preserve Preserves ofile independent of the generated ``#line'' lines. This is useful for Makefiles if the real contents of ofile will not change, just line numbers. Default is to overwrite. -f, --filter filter Apply one or more pre-processing sed(1) filter commands (usually of type ``"s/.../.../"'') to each input file before their input is parsed. This option can occur multiple times. -o, --output ofile Output file name. Default is "lib.h". -t, --template tfile Template file name. Default is "lib.h.in". -M, --mark mark Mark to be replaced by generated constructs. Default is "%%MARK%%". -D, --define dname FIXME. Default is "cpp". -C, --class cname FIXME. Default is "intern". EXAMPLE
# Makefile SRCS=foo_bar.c foo_quux.c foo_p.h: foo_p.h.in shtool scpp -o foo_p.h -t foo_p.h.in -M %%MARK%% -D cpp -C intern $(SRCS) /* foo_p.h.in */ #ifndef FOO_P_H #define FOO_P_H %%MARK%% #endif /* FOO_P_H */ /* foo_bar.c */ #include "foo_p.h" #if cpp #define OURS_INIT 4711 #endif intern int ours; static int myone = 0815; intern int bar(void) { ours += myone; } /* foo_quux.c */ #include "foo_p.h" int main(int argc, char *argv[]) { int i; ours = OURS_INIT for (i = 0; i < 10; i++) { bar(); printf("ours now %d ", ours); } return 0; } HISTORY
The GNU shtool scpp command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1999 for GNU shtool. Its was prompted by the need to have a pre-processing facility in the GNU pth project. SEE ALSO
shtool(1), cpp(1). 18-Jul-2008 shtool 2.0.8 SHTOOL-SCPP.TMP(1)
All times are GMT -4. The time now is 02:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy