Sponsored Content
Top Forums Shell Programming and Scripting handling multiple files using awk command and wants to get separate out file for each Post 302420952 by hema dhevi on Thursday 13th of May 2010 03:23:38 AM
Old 05-13-2010
MySQL handling multiple files using awk command and wants to get separate out file for each

hai all
I am new to the world of shell scripting

I wanted to extract two columns from multiple files say around 25 files
and i wanted to get the separate outfile for each input file

tired using the following command to extract two columns from 25 files

Code:
awk '/ATOM/ {print $4,$6}' *.A.pdb >all.txt


files names are like 1_A.pdb, 2_A.pdb, ... 25_A.pdb

but the problem is, its giving everything in a single file i dont want to get it like that
is there any other way to get separate files for each input file



please help me in this regard

thanks lot for ur time
Hema


Moderator's Comments:
Mod Comment Added code tags.

Last edited by radoulov; 05-13-2010 at 06:13 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Multiple file handling

Dear All, I have two files, which looks like: File 1 124 235 152 178 156 142 178 163 159 File 2 124|5623 452|6698 178|9995 (8 Replies)
Discussion started by: rochitsharma
8 Replies

2. Shell Programming and Scripting

Splitting input files into multiple files through AWK command

Hi, I needs to split *.txt files from single directory depends on the some mutltiple input values. i have wrote the code like below for file in *.txt do grep -i -h "value1|value2" $file > $file; done. My requirment is more input values needs to be given in grep; let us say 50... (3 Replies)
Discussion started by: arund_01
3 Replies

3. Shell Programming and Scripting

awk command to separate a field

I have a log file that I am trying to convert. File contents something like this: aaaaa bbbbbb cccc dddddd\123 eeeee ffffffff I am trying to output the fields in a different order and separate field 4 so that the "123" and "dddddd" can be output separately. for example bbbbbb aaaaa 123... (5 Replies)
Discussion started by: jake1988
5 Replies

4. Shell Programming and Scripting

Using AWK to separate data from a large XML file into multiple files

I have a 500 MB XML file from a FileMaker database export, it's formatted horribly (no line breaks at all). The node structure is basically <FMPXMLRESULT> <METADATA> <FIELD att="............." id="..."/> </METADATA> <RESULTSET FOUND="1763457"> <ROW att="....." etc="...."> ... (16 Replies)
Discussion started by: JRy
16 Replies

5. Shell Programming and Scripting

Handling multiple fields of a database file for toupper() function in awk

hello everyone.... script is: To convert the contents of a database file into uppercase my code is: printf "%s\n" , $2 | awk '{print toupper($2)}' emp.lst i m able to do only for one field.....didn't get any sources for handling multiple fields. please suggest me for multiple... (1 Reply)
Discussion started by: Priyanka Bhati
1 Replies

6. UNIX for Dummies Questions & Answers

awk to match multiple regex and create separate output files

Howdy Folks, I have a list that looks like this: (file2.txt) AAA BBB CCC DDD and there are 24 of these short words. I am matching these patterns to another file with 755795 lines (file1.txt). I have this code for matching: awk -v f2=file2.txt ' BEGIN { while(... (2 Replies)
Discussion started by: heecha
2 Replies

7. Shell Programming and Scripting

[SOLVED] Handling multiple files using awk

Hi, I am trying to process 2 files simultaneously using awk satisfying following condition, Both files contain 3 columns. It should take entry from column 1 from first file, look for that entry in file 2 and if found, add column 2 and column 3 from both files and output to third file. For e.g.... (4 Replies)
Discussion started by: muazfarooqaslam
4 Replies

8. Shell Programming and Scripting

create separate files from one excel file with multiple sheets

Hi, I have one requirement, create separate files (".csv") from one excel file(xlsx) with multiple sheets. These ".csv" files are my source files. So anybody please suggest me the process. Thanks in Advance. Regards, Harris (3 Replies)
Discussion started by: harris
3 Replies

9. Shell Programming and Scripting

ISSUE in handling multiple same name files :-(

Dear all, My work is completely stuck cos of the following issue. Please find it here and kindly help me. Task is following: I have set of files with such pattern 1t-rw-rw-r-- 1 emily emily 119 Jun 11 10:45 vgtree_5_1_pfs.root 3t-rw-rw-r-- 1 emily emily 145 Jun 11 10:46 vgtree_5_3_pfs.root... (4 Replies)
Discussion started by: emily
4 Replies

10. 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
CCOMPS(1)						      General Commands Manual							 CCOMPS(1)

NAME
ccomps - connected components filter for graphs SYNOPSIS
ccomps [ -sxvnzC? ] [ -X[#]v ] [ -ooutfile ] [ files ] DESCRIPTION
ccomps decomposes graphs into their connected components, printing the components to standard output. OPTIONS
The following options are supported: -s No output graph is printed. The return value can be used to check if the graph is connected or not. -x Only the connected components are printed, as separate graphs. -v Counts of nodes, edges and connected components are printed. -z Sort components by size, with the largest first. This is only effective if either -x or -X#v is present. Thus, -zX#0 will cause the largest component to be printed. -C Use clusters in computing components in addition to normal edge connectivity. In essence, this gives the connected components of the derived graph in which nodes top-level clusters and nodes in the original graph. This maintains all subgraph structure within a com- ponent, even if a subgraph does not contain any nodes. -n Do not project subgraph structure. Normally, if ccomps produces components as graphs distinct from the input graph, it will define subgraphs which are projections of subgraphs of the input graph onto the component. (If the projection is empty, no subgraph is pro- duced.) If this flag is set, the component contains only the relevant nodes and edges. -X node_name Prints only the component containing the node node_name, if any. -X# index Prints only component number index, if any, starting at 0. -o outfile If specified, each graph will be written to a different file with the names derived from outfile. In particular, if both -o and -x flags are used, then each connected component is written to a different file. If outfile does not have a suffix, the first file will have the name outfile; then next outfile_1, then next outfile_2, and so on. If outfile has a suffix, i.e., has the form base.sfx, then the files will be named base.sfx, base_1.sfx, base_2.sfx, etc. By default, each input graph is printed, with each connected component given as a subgraph whose name is a concatenation of the name of the input graph, the string "_component_" and the number of the component. OPERANDS
The following operand is supported: files Names of files containing 1 or more graphs in dot format. If no files operand is specified, the standard input will be used. RETURN CODES
Unless used to extract a single connected component, ccomps returns 0 if all the input graphs are connected; and non-zero if any graph has multiple components, or any error occurred. If just extracting a single component, ccomps returns 0 on success and non-zero if an error occurred. BUGS
It is possible, though unlikely, that the names used for connected components and their subgraphs may conflict with existing subgraph names. AUTHORS
Stephen C. North <north@research.att.com> Emden R. Gansner <erg@research.att.com> SEE ALSO
gc(1), dot(1), gvpr(1), gvcolor(1), acyclic(1), sccmap(1), tred(1), libgraph(3) 27 August 2008 CCOMPS(1)
All times are GMT -4. The time now is 02:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy