Sponsored Content
Top Forums Shell Programming and Scripting Parse tab delimited file, check condition and delete row Post 302702579 by empyrean on Tuesday 18th of September 2012 02:13:28 PM
Old 09-18-2012
cool.. much clear, easy and very few lines of code.. Thank you rdrtx1
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check whether a given file is in ASCII format and data is tab-delimited

Hi All, Please help me out with a script which checks whether a given file say abc.txt is in ASCII format and data is tab-delimited. If the condition doesn't satisfy then it should generate error code "100" for file not in ASCII format and "105" if it is not in tab-delimited format. If the... (9 Replies)
Discussion started by: Mandab
9 Replies

2. Shell Programming and Scripting

Delete parts of a string of character in one given column of a tab delimited file

I would like to remove characters from column 7 so that from an input file looking like this: >HWI-EAS422_12:4:1:69:89 GGTTTAAATATTGCACAAAAGGTATAGAGCGT U0 1 0 0 ref_chr8.fa 6527777 F DD I get something like that in an output file: ... (13 Replies)
Discussion started by: matlavmac
13 Replies

3. Shell Programming and Scripting

Delete first column in tab-delimited text-file

I have a large text-file with tab-delimited genetic data that looks like: KSC112 KSC234 0 0 1 1 A G C T I simply wan to delete the first column, but since the file has 600 000 columns, it is not possible with awk (seems to be limited at 32k columns). Does anyone have an idea how to do this? (2 Replies)
Discussion started by: andmal
2 Replies

4. UNIX for Dummies Questions & Answers

How do you delete cells from a space delimited text file given row and column number?

How do you delete cells from a space delimited text file given row and column number? Letś say the row number is r and the column number is c. Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies

5. UNIX for Dummies Questions & Answers

Delete header row and reformat from tab delimited to fixed width

Hello gurus, I have a file in a tab delimited format and a header row. I need a code to delete the header in the file, and convert the file to a fixed width format, with all the columns aligned. Below is a sample of the file:... (4 Replies)
Discussion started by: chumsky
4 Replies

6. Shell Programming and Scripting

Delete an entire column from a tab delimited file

Hi, Can anyone please tell me about how we can delete an entire column from a tab delimited file? Mu input_file.txt looks like this: And I want the output as: I used the below code nawk -v d="1" 'BEGIN{FS=OFS="\t"}{$d=""}{print}' input_file.txtBut in the output, the first column is... (5 Replies)
Discussion started by: sampoorna
5 Replies

7. Shell Programming and Scripting

Delete and insert columns in a tab delimited file

Hi all , I have a file having 12 columns tab delimited . I need to read this file and remove the column 3 and column 4 and insert a word in column 3 as "AVIALABLE " Is there a way to do this . I am trying like below Thanks DJ cat $FILENAME|awk -F"\t" '{ print $1 "\t... (3 Replies)
Discussion started by: Hypesslearner
3 Replies

8. UNIX for Dummies Questions & Answers

Need to convert a pipe delimited text file to tab delimited

Hi, I have a rquirement in unix as below . I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column. ex: Input Text file: 1|A|apple 2|B|bottle excel file to be generated as output as... (9 Replies)
Discussion started by: raja kakitapall
9 Replies

9. UNIX for Beginners Questions & Answers

awk to parse current and next row in tab-delimited file

Hi there, I would like to use awk to reformat a tab-delimited file containing three columns as follows: Data file: sample 1 173 sample 269 530 sample 687 733 sample 1699 1779 Desired output file: sample 174..265, 531..686, 734..1698 I need the value... (5 Replies)
Discussion started by: emiley
5 Replies

10. UNIX for Beginners Questions & Answers

Replace a column in tab delimited file with column in other tab delimited file,based on match

Hello Everyone.. I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files FileP.txt ... (2 Replies)
Discussion started by: YogeshG
2 Replies
SELECTALL_XML(1p)					User Contributed Perl Documentation					 SELECTALL_XML(1p)

NAME
stag-selectall_xml - Query all elements from database with an XML output SYNOPSIS
stag-selectall_xml [-d <dbi>] [-f file of sql] [-nesting|n <nesting>] SQL DESCRIPTION
This script will query a database using either SQL provided by the script user, or using an SQL templates; the query results will be turned into XML using the DBIx::DBStag module. The nesting of the XML can be controlled by the DBStag SQL extension "USE NESTING..." EXAMPLES stag-selectall_xml -d "dbi:Pg:dbname=mydb;host=localhost" "SELECT * FROM a NATURAL JOIN b" TEMPLATES A parameterized SQL template (canned query) can be used instead of specifying the full SQL For example: stag-selectall_xml -d genedb /genedb-gene gene_symbol=Adh Or: stag-selectall_xml -d genedb /genedb-gene Adh Or: stag-selectall_xml -d genedb /genedb-gene gene_symbol@=Adh,dpp,bam,indy A template is indicated by the syntactic shorthand of using a slash to precede the template name; in this case the template is called genedb-gene. the -t option can also be used. All the remaining arguments are passed in as SQL template parameters. They can be passed in as either name=value pairs, or as a simple list of arguments which get passed into the template in order To use templates, you should have the environment variable DBSTAG_TEMPLATE_DIRS set. See DBIx::DBStag for details. LISTING AVAILABLE TEMPLATES FOR A DB stag-selectall_xml -d mydb -h LISTING VARIABLES FOR A TEMPLATE stag-selectall_xml /genedb-gene -h ENVIRONMENT VARIABLES
DBSTAG_DBIMAP_FILE A file containing configuration details for local databases DBSTAG_TEMPLATE_DIRS list of directories (separated by :s) to be searched when templates are requested COMMAND LINE ARGUMENTS
-h|help shows this page if no other arguments are given if a template is specified, gives template details if a db is specified, lists templates for that db use in conjunction with -v for full descriptions -d|dbname DBNAME this is either a full DBI locator string (eg dbi:Pg:dbname=mydb;host=localhost) or it can also be a shortened "nickname", which is then looked up in the file pointed at by the environment variable DBSTAG_DBIMAP_FILE -u|user USER database user identity -p|password PASS database password -f|file SQLFILE this is a path to a file containing SQL that will be executed, as an alternative to writing the SQL on the command line -n|nesting NESTING-EXPRESSIONS a bracketed expression indicating how to the resulting objects/XML should be nested. See DBIx::DBStag for details. -t|template TEMPLATE-NAME the name of a template; see above -wh|where WHERE-CLAUSE used to override the WHERE clause of the query; useful for combining with templates You can append to an existing where clause by using the prefix + -s|select SELECT-COLS used to override the SELECT clause of the query; useful for combining with templates -rows sometimes it is preferable to return the results as a table rather than xml or a similar nested structure. specifying -rows will fetch a table, one line per row, and columns separated by tabs -pre SQL a piece of SQL is that is executed immediately before the main query; e.g.: -pre "SET search_path=myschema,public" -o|out FILE a file to output the results to -w|writer WRITER writer class; can be any perl class, or one of these xml [default] sxpr lisp S-Expressions itext indented text -color shows results in color (sxpr and itext only) -show will show the parse of the SQL statement perl v5.12.4 2011-10-14 SELECTALL_XML(1p)
All times are GMT -4. The time now is 02:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy