Sponsored Content
Top Forums Shell Programming and Scripting how to convert comma delimited file to tab separator Post 302600618 by alister on Tuesday 21st of February 2012 02:47:35 PM
Old 02-21-2012
Quote:
Originally Posted by methyl
Code:
cat oldfile.txt | tr '[,]' '[\t]' > newfile.txt

Why the square brackets? If those are intended to be single character bracket expressions, tr does not support that syntax. Well, I should say, POSIX tr. Perhaps that is an older dialect? In modern implementations, that simply replaces [ with itself and ] with itself, a couple of no-ops, in addition to comma with tab.

Or am I overlooking something?

Regards,
Alister
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

how to convert this file into comma delimited format

Hi experts, I need urget help! I have the a text file with this format: Types of fruits Name of fruits 1,1 Farm_no,1 apple,1 pineapple,1 grapes,1 orange,1 banana,1 2,2--->this is the record seperator Farm_no,2 apple,1 pineapple,1 grapes,3 orange,2 banana,1 3,3--->this is the... (1 Reply)
Discussion started by: natalie23
1 Replies

3. UNIX for Advanced & Expert Users

Urgent! need help! how to convert this file into comma delimited format

Hi experts, I need urget help! I have the a text file with this format: Types of fruits Name of fruits 1,1 Farm_no,1 apple,1 pineapple,1 grapes,1 orange,1 banana,1 2,2--->this is the record seperator Farm_no,2 apple,1 pineapple,1 grapes,3 orange,2 banana,1 3,3--->this is the... (2 Replies)
Discussion started by: natalie23
2 Replies

4. UNIX for Dummies Questions & Answers

How to convert a text file into tab delimited format?

I have a text file that made using text editor in Ubuntu. However the text file is not being recognized as space or tab delimited, the formatting seems to be messed up. How can I convert the text file into tab delimited format? (3 Replies)
Discussion started by: evelibertine
3 Replies

5. Shell Programming and Scripting

Need a script to convert comma delimited files to semi colon delimited

Hi All, I need a unix script to convert .csv files to .skv files (changing a comma delimited file to a semi colon delimited file). I am a unix newbie and so don't know where to start. The script will be scheduled using cron and needs to convert each .csv file in a particular folder to a .skv... (4 Replies)
Discussion started by: CarpKing
4 Replies

6. Shell Programming and Scripting

Convert a 3 column tab delimited file to a matrix

Hi all, I have a 3 columns input file like this: CPLX9PC-4943 CPLX9PC-4943 1 CPLX9PC-4943 CpxID123 0 CPLX9PC-4943 CpxID126 0 CPLX9PC-4943 CPLX9PC-5763 0.5 CPLX9PC-4943 CpxID13 0 CPLX9PC-4943 CPLX9PC-6163 0 CPLX9PC-4943 CPLX9PC-6164 0.04... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

7. Shell Programming and Scripting

How to convert space&tab delimited file to CSV?

Hello, I have a text file with space and tab (mixed) delimited file and need to convert into CSV. # cat test.txt /dev/rmt/tsmmt32 HP Ultrium 6-SCSI J3LZ 50:03:08:c0:02:72:c0:b5 F00272C0B5 0/0/6/1/1.145.17.255.0.0.0 /dev/rmt/c102t0d0BEST /dev/rmt/tsmmt37 ... (6 Replies)
Discussion started by: prvnrk
6 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. Shell Programming and Scripting

Convert pipe demilited file to vertical tab delimited

Hi All, How can we convert pipe delimited ( or comma ) file to vertical tab (VT) delimited. Regards PK (4 Replies)
Discussion started by: prasson_ibm
4 Replies

10. Shell Programming and Scripting

Linux convert Comma delimited file to pipe

I have file in linux with comma delimited and string fields in double quotations ", I need to convert them to pipe delimiter please share your inputs. Example: Input: "2017-09-30","ACBD,TVF","01234",NULL,18,NULL,"686091802","BANK OF ABCD, LIMITED, THE",790456 Output: ... (4 Replies)
Discussion started by: shieksir
4 Replies
dtfits(1)						      General Commands Manual							 dtfits(1)

NAME
dtfits - display FITS table SYNOPSIS
dtfits <table> DESCRIPTION
dtfits dumps the contents of a FITS table in an ASCII format, either into a user-specified file or on stdout. The output is formatted on a fixed number of columns to make it readable by human beings. Additional informations are printed out before the table values are dumped, these informations can be skipped by using the -d option. Last, if you want to dump the table into an easily parsable format (for a piece of software), you might want to use the -s option which specifies a character to use as separator. All data fields will be printed out separated by this character only. This allows to use string parsers to cut down the output lines into tokens by looking for this separator. Fields (lines) will still be delimited by the end-of-line character. This option produces ASCII tables which are easy to parse for a piece of software but mostly unreadable to human beings. Notice that dtfits only accepts one single FITS table in input. OPTIONS
-d Skip information output about the table and column names. Outputs only the table values. Beware that if the FITS file contains sev- eral extensions, they will all appear one after another, separated only by two blank lines. In that case, it would be preferrable to keep the complete output and parse out the returned stream to differentiate which data come from where. -s <char> Use the character <char> as separator in output. This option is useful if you want to produce a table that should be parsed by a piece of software (see above description). The separator can only be a single non-null character. To avoid special characters being interpreted by the shell, it is recommended to provide this character always between simple or double quotes. Example: dtfits -s '&' table.tfits If you want to use a special character as separator, such as a tab, use ^V to insert your character, such as: dtfits -s '^V<TAB>' table.tfits which means: you type CTRL-V and then the tab key. SEE ALSO
dfits FILES
FITS tables are stored into extensions. If there are several tables in a file, they will all be displayed one after another in the same output stream. 22 Dec 1999 dtfits(1)
All times are GMT -4. The time now is 04:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy