Sponsored Content
Full Discussion: Read a tab delimited
Top Forums UNIX for Dummies Questions & Answers Read a tab delimited Post 302247985 by podzach on Thursday 16th of October 2008 08:50:30 PM
Old 10-16-2008
Read a tab delimited

OK, let's set this up. I have a tab delimited file from excel. In my UNIX shell I have the following lines
Code:
   IFS=`printf "\t"`
   while read LINE_NO SKIP IGNORE_ERRORS OTHER
   do
 ....

This works fine if there is something in every column like this. NOTE, those are tabs, not spaces. Smilie
Code:
17      SKIP    FALSE   Endofline

LINE_NO=17
SKIP=SKIP
IGNORE_ERRORS=FALSE
OTHER=Endofline


The problem comes about if one of the columns is a null like this.
Code:
17                FALSE   Endofline

LINE_NO=17
SKIP=FALSE
IGNORE_ERRORS=Endofline
OTHER=

How do I get unix to see that double tab? I am on an AIX box running a ksh shell.

Thanks for your time
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

tab delimited file to commas

Hi there Just wondered if someone could help me out I have a file that has been delimited by tabs, ie field1<tab>fiield2<tab>field3 Does anybody know a command that will convert tabs to commas throughout the entire file? Note: there are a number of unpopulated fields in the file so... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

2. Shell Programming and Scripting

Converting Tab delimited file to Comma delimited file in Unix

Hi, Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies

3. UNIX for Dummies Questions & Answers

Converting Space delimited file to Tab delimited file

Hi all, I have a file with single white space delimited values, I want to convert them to a tab delimited file. I tried sed, tr ... but nothing is working. Thanks, Rajeevan D (16 Replies)
Discussion started by: jeevs81
16 Replies

4. UNIX for Dummies Questions & Answers

tab delimited file that is not tab delimited.

Hi Forum I have a tab delimited file that opens well in Openoffice calc (excel). But when I perform any operation in command line, it reads the file incorrectly. When I 'save As' the same file in office as tab delimited then it works fine. The file that I think is tab delimited is actually... (8 Replies)
Discussion started by: imlearning
8 Replies

5. Shell Programming and Scripting

Help with converting Pipe delimited file to Tab Delimited

I have a file which was pipe delimited, I need to make it tab delimited. I tried with sed but no use cat file | sed 's/|//t/g' The above command substituted "/t" not tab in the place of pipe. Sample file: abc|123|2012-01-30|2012-04-28|xyz have to convert to: abc 123... (6 Replies)
Discussion started by: karumudi7
6 Replies

6. Homework & Coursework Questions

Shell Script to read a tab delimited file and perform simple tasks

1. The problem statement, all variables and given/known data: Hello! I need help with this problem bash shell scripting that basically just reads the data in a tab delimited file and does the following below 1. Read in the data file Survey.txt and assign the column values to variables of... (6 Replies)
Discussion started by: jsmith6932
6 Replies

7. Shell Programming and Scripting

How to make tab delimited file to space delimited?

Hi How to make tab delimited file to space delimited? in put file: ABC kgy jkh ghj ash kjl o/p file: ABC kgy jkh ghj ash kjl Use code tags, thanks. (1 Reply)
Discussion started by: jagdishrout
1 Replies

8. Shell Programming and Scripting

How to read data from tab delimited file after a specific position?

Hi Experts, I have a tab deliminated file as below myfile.txt Local Group Memberships *Administrators *Guests I need data in below format starting from 4th position. myfile1.txt Administrators Guests the above one is just an example and there could... (15 Replies)
Discussion started by: Litu1988
15 Replies

9. 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

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
ExtUtils::Manifest(3pm) 				 Perl Programmers Reference Guide				   ExtUtils::Manifest(3pm)

NAME
ExtUtils::Manifest - utilities to write and check a MANIFEST file SYNOPSIS
require ExtUtils::Manifest; ExtUtils::Manifest::mkmanifest; ExtUtils::Manifest::manicheck; ExtUtils::Manifest::filecheck; ExtUtils::Manifest::fullcheck; ExtUtils::Manifest::skipcheck; ExtUtils::Manifest::manifind(); ExtUtils::Manifest::maniread($file); ExtUtils::Manifest::manicopy($read,$target,$how); DESCRIPTION
mkmanifest() writes all files in and below the current directory to a file named in the global variable $ExtUtils::Manifest::MANIFEST (which defaults to "MANIFEST") in the current directory. It works similar to find . -print but in doing so checks each line in an existing "MANIFEST" file and includes any comments that are found in the existing "MANIFEST" file in the new one. Anything between white space and an end of line within a "MANIFEST" file is considered to be a comment. Filenames and comments are separated by one or more TAB characters in the output. All files that match any regular expression in a file "MANIFEST.SKIP" (if such a file exists) are ignored. manicheck() checks if all the files within a "MANIFEST" in the current directory really do exist. If "MANIFEST" and the tree below the cur- rent directory are in sync it exits silently, returning an empty list. Otherwise it returns a list of files which are listed in the "MANI- FEST" but missing from the directory, and by default also outputs these names to STDERR. filecheck() finds files below the current directory that are not mentioned in the "MANIFEST" file. An optional file "MANIFEST.SKIP" will be consulted. Any file matching a regular expression in such a file will not be reported as missing in the "MANIFEST" file. The list of any extraneous files found is returned, and by default also reported to STDERR. fullcheck() does both a manicheck() and a filecheck(), returning references to two arrays, the first for files manicheck() found to be missing, the seond for unexpeced files found by filecheck(). skipcheck() lists all the files that are skipped due to your "MANIFEST.SKIP" file. manifind() returns a hash reference. The keys of the hash are the files found below the current directory. maniread($file) reads a named "MANIFEST" file (defaults to "MANIFEST" in the current directory) and returns a HASH reference with files being the keys and comments being the values of the HASH. Blank lines and lines which start with "#" in the "MANIFEST" file are discarded. "manicopy($read,$target,$how)" copies the files that are the keys in the HASH %$read to the named target directory. The HASH reference $read is typically returned by the maniread() function. This function is useful for producing a directory tree identical to the intended distribution tree. The third parameter $how can be used to specify a different methods of "copying". Valid values are "cp", which actually copies the files, "ln" which creates hard links, and "best" which mostly links the files but copies any symbolic link to make a tree with- out any symbolic link. Best is the default. MANIFEST.SKIP The file MANIFEST.SKIP may contain regular expressions of files that should be ignored by mkmanifest() and filecheck(). The regular expres- sions should appear one on each line. Blank lines and lines which start with "#" are skipped. Use "#" if you need a regular expression to start with a sharp character. A typical example: # Version control files and dirs. RCS CVS ,v$ # Makemaker generated files and dirs. ^MANIFEST. ^Makefile$ ^blib/ ^MakeMaker-d # Temp, old and emacs backup files. ~$ .old$ ^#.*#$ ^.# If no MANIFEST.SKIP file is found, a default set of skips will be used, similar to the example above. If you want nothing skipped, simply make an empty MANIFEST.SKIP file. EXPORT_OK &mkmanifest, &manicheck, &filecheck, &fullcheck, &maniread, and &manicopy are exportable. GLOBAL VARIABLES
$ExtUtils::Manifest::MANIFEST defaults to "MANIFEST". Changing it results in both a different "MANIFEST" and a different "MANIFEST.SKIP" file. This is useful if you want to maintain different distributions for different audiences (say a user version and a developer version including RCS). $ExtUtils::Manifest::Quiet defaults to 0. If set to a true value, all functions act silently. $ExtUtils::Manifest::Debug defaults to 0. If set to a true value, or if PERL_MM_MANIFEST_DEBUG is true, debugging output will be produced. DIAGNOSTICS
All diagnostic output is sent to "STDERR". "Not in MANIFEST:" file is reported if a file is found which is not in "MANIFEST". "Skipping" file is reported if a file is skipped due to an entry in "MANIFEST.SKIP". "No such file:" file is reported if a file mentioned in a "MANIFEST" file does not exist. "MANIFEST:" $! is reported if "MANIFEST" could not be opened. "Added to MANIFEST:" file is reported by mkmanifest() if $Verbose is set and a file is added to MANIFEST. $Verbose is set to 1 by default. ENVIRONMENT
PERL_MM_MANIFEST_DEBUG Turns on debugging SEE ALSO
ExtUtils::MakeMaker which has handy targets for most of the functionality. AUTHOR
Andreas Koenig <andreas.koenig@anima.de> perl v5.8.0 2002-06-01 ExtUtils::Manifest(3pm)
All times are GMT -4. The time now is 04:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy