09-28-2008
Hey Franklin,
A strange thing is happening with the output, and I believe it is due to the fact that the columns contain spaces and lots of text.
The script took the spaces in Column0 and made them into new columns, then trimmed the new Column2.
My original data reads like this:
Column 0 is the product name:
"Shure KSM109 Condenser Microphone"
Column 1 is description, which is a paragraph of text:
"The Shure KSM109 offers incredible performance for its price. It combines an extended...."
Column 2 is the Manufacturer code, which needs to be trimmed:
SHUKSM109SL <---(I need to chop SHU)
The output data is looking like this:
Column 0: "Shure"
Column 1: "KSM100"
Column 2: "denser"
So basically it looks like it is treating spaces as tabs. I really appreciate it this help Franklin - thanks so much!
- Rick
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
2. Shell Programming and Scripting
Hi all,
I'm new to Unix and work primarily in bioinformatics. I am in need of a script which will allow me to replace "1" with "chr1" in only the first column of a file which looks like such:
1 10327 rs112750067 T C . PASS ASP;RSPOS=10327;... (4 Replies)
Discussion started by: Hkins552
4 Replies
3. UNIX for Dummies Questions & Answers
How do I use awk to log transform the fifth column of a tab-delimited text file? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies
4. Shell Programming and Scripting
I have a file which looks like this:
73450 articles and news developmental psychology 2006-03-30 16:22:40 1 http://www.usnews.com
73450 articles and news developmental psychology 2006-03-30 16:22:40 2 http://www.apa.org
73450 articles and news developmental psychology 2006-03-30... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
5. UNIX for Dummies Questions & Answers
I have a file having the following entries:
test1 test2 test3
11 22 33
22 44 66
99 99 44
---
I want to add a column so that the above file becomes:
test1 test2 test3 notest
11 22 33 *
22 44 66 *
99 99 44 *
---
Thanks (6 Replies)
Discussion started by: mary271
6 Replies
6. Shell Programming and Scripting
Hello,
I have this sentence :Pattern1 Pattern2 Pattern3 Pattern4-which-contains-HELLO-string-and-other-stuff-and-second-HELLO-and-third-HELLO
I want to delete everything between the 3rd tab (\t) and the FIRST pattern "HELLO" of the line.
Result expected is : Pattern1 ... (7 Replies)
Discussion started by: theclem35
7 Replies
7. Shell Programming and Scripting
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
8. UNIX for Dummies Questions & Answers
I have tried the following to no avail.
xargs -n8 < test.txt
awk '{if(NR%6!=0){p=""}else{p="\n"};printf $0" "p}' Mod_Alm_log.txt > test.txt
I have tried different variations of the above, the problem is mixes lines together.
And it includes the tags "%a and %A" I need them to be all tab... (16 Replies)
Discussion started by: mytouchsr
16 Replies
9. Shell Programming and Scripting
input
"A","B","C,D","E","F"
"S","T","U,V","W","X"
"AA","BB","CC,DD","EEEE","FFF"
required output:
"A","B","C,D","C,D","F"
"S", T","U,V","U,V","X"
"AA","BB","CC,DD","CC,DD","FFF"
tried using awk but double quotes not preserving for every field. any help to solve this is much... (5 Replies)
Discussion started by: khblts
5 Replies
10. UNIX for Beginners Questions & Answers
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
LEARN ABOUT DEBIAN
alzabo::create::index
Alzabo::Create::Index(3pm) User Contributed Perl Documentation Alzabo::Create::Index(3pm)
NAME
Alzabo::Create::Index - Index objects for schema creation
SYNOPSIS
use Alzabo::Create::Index;
DESCRIPTION
This object represents an index on a table. Indexes consist of columns and optional prefixes for each column. The prefix specifies how
many characters of the columns should be indexes (the first X chars). Some RDBMS's do not have a concept of index prefixes. Not all col-
umn types are likely to allow prefixes though this depends on the RDBMS. The order of the columns is significant.
INHERITS FROM
"Alzabo::Index"
Note: all relevant documentation from the superclass has been merged into this document.
METHODS
new
The constructor takes the following parameters:
* table => "Alzabo::Create::Table" object
The table that this index is indexing.
* columns => [ "Alzabo::Create::Column" object, .. ]
* columns => [ { column => "Alzabo::Create::Column" object, prefix => $prefix }, repeat as needed ... ]
This parameter indicates which columns that are being indexed. It can either be an array reference of column objects, or an array ref-
erence of hash references, each with a key called column and one called prefix.
The prefix key is optional.
* unique => $boolean
Indicates whether or not this is a unique index.
* fulltext => $boolean
Indicates whether or not this is a fulltext index.
* function => $string
This can be used to create a function index where supported. The value of this parameter should be the full function, with column
names, such as "LCASE( username )".
The "columns" parameter should include all the columns used in the function.
Returns a new "Alzabo::Create::Index" object.
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
table
Returns the "Alzabo::Create::Table" object to which the index belongs.
columns
Returns an ordered list of the "Alzabo::Create::Column" objects that are being indexed.
add_column
Adds a column to the index.
This method takes the following parameters:
* column => "Alzabo::Create::Column" object
* prefix => $prefix (optional)
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
delete_column ("Alzabo::Create::Column" object)
Deletes the given column from the index.
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
prefix ("Alzabo::Create::Column" object)
A column prefix is, to the best of my knowledge, a MySQL specific concept, and as such cannot be set when using an RDBMSRules module for a
different RDBMS. However, it is important enough for MySQL to have the functionality be present. It allows you to specify that the index
should only look at a certain portion of a field (the first N characters). This prefix is required to index any sort of BLOB column in
MySQL.
This method returns the prefix for the column in the index. If there is no prefix for this column in the index, then it returns undef.
set_prefix
This method takes the following parameters:
* column => "Alzabo::Create::Column" object
* prefix => $prefix
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
unique
Returns a boolean value indicating whether the index is a unique index.
set_unique ($boolean)
Sets whether or not the index is a unique index.
fulltext
Returns a boolean value indicating whether the index is a fulltext index.
set_fulltext ($boolean)
Set whether or not the index is a fulltext index.
Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules"
register_column_name_change
This method takes the following parameters:
* column => "Alzabo::Create::Column" object
The column (with the new name already set).
* old_name => $old_name
This method is called by the table object which owns the index when a column name changes. You should never need to call this yourself.
Throws: "Alzabo::Exception::Params"
id
The id is generated from the table, column and prefix information for the index. This is useful as a canonical name for a hash key, for
example.
Returns a string that is the id which uniquely identifies the index in this schema.
AUTHOR
Dave Rolsky, <autarch@urth.org>
perl v5.8.8 2007-12-23 Alzabo::Create::Index(3pm)