Sponsored Content
Full Discussion: replace comma(,) with Tab
Top Forums Shell Programming and Scripting replace comma(,) with Tab Post 302258172 by vikas_kesarwani on Friday 14th of November 2008 01:05:30 AM
Old 11-14-2008
Error replace comma(,) with Tab

hi all,

i have a file with commas(,). i want to replace all the commas with tab(\t).

Plz help...its urgent...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace , (comma) with space

Hi, what is the better way to replace the , (comma) with a space char? Example:STRING=dir1,dir2,dir3 toSTRING=dir1 dir2 dir3 And.. how to find if in the string there is a comma? Thanks :) (6 Replies)
Discussion started by: mbarberis
6 Replies

2. UNIX for Dummies Questions & Answers

Replacing Comma by Tab

Hi All, i have a file test.txt as shown below, 1,test,test111 2,rest,rest222 i want to replace the commas by tab delimiter.., it should be like, 1 test test111 2 rest rest222 i tried the following code, sed 's/,/\\t/g' test.txt >> ouptut.txt (9 Replies)
Discussion started by: Serious Sam
9 Replies

3. Shell Programming and Scripting

Replace comma with newline

Hi, for some reason I cant seem to figure this out. I have a file which looks something like this word word word word word,word,word word word word,word,word,word,word word word Basically I want this whole thing to be a list with 1 word on each line like this... word word word... (1 Reply)
Discussion started by: eltinator
1 Replies

4. Shell Programming and Scripting

Replace with tab

I have text file, i want to replace all the charecters with tab. suppose: cat abc.txt dfjkdf dfdfd fd fd the output should have 4 lines and each line will have 1 tab. Thanks :confused: (2 Replies)
Discussion started by: javeed7
2 Replies

5. Shell Programming and Scripting

Replace the | with Comma

Hi, The input file structure is given below: The Col1 and Col2 will be there always. But from Col3 there can be more columns. And Col3 will be always Col4 and Col5 will always be with Col6. I need to replace the | with comma. There are scnearios where there wont be no data.Below, the row 2... (6 Replies)
Discussion started by: bharathappriyan
6 Replies

6. UNIX for Dummies Questions & Answers

Making a Tab delimiter file to Comma

How can i make a tab delimiter file to a comma delimiter??? (13 Replies)
Discussion started by: saggiboy10
13 Replies

7. Shell Programming and Scripting

how to convert comma delimited file to tab separator

Hi all, How can i convert comma delimited .csv file to tab separate using sed command or script. Thanks, Krupa (4 Replies)
Discussion started by: krupasindhu18
4 Replies

8. UNIX for Dummies Questions & Answers

How to replace two or more spaces with one comma?

I'm using sh on hp-ux. I've got a file that looks like this. -5.65 175 -16.17 160 -13.57 270 -51.72 260 -8.30 360 -42.71 460 -.38 375 -.20 375 -4.15 170 -21.53 560 -18.84 360 I'd like to replace all the whitespace between the columns with one comma. I can't... (4 Replies)
Discussion started by: Scottie1954
4 Replies

9. Shell Programming and Scripting

Replace comma and blank with comma and number

I, I have a file and i need to replace comma and blank space with comma and 0. cat file.txt a,5 b,1 c, d, e,4 I need the output as cat file.txt a,5 b,1 c,0 d,0 (4 Replies)
Discussion started by: jaituteja
4 Replies

10. Shell Programming and Scripting

Replace spaces with underscores up to first comma but not after the comma

I have a comma delimited file of major codes and descriptions. I want to replace all occurrences of spaces with underscores up to the first comma (only in the first field), but not replace spaces following the comma. For instance I have the following snippet of the file: EK ED,Elementary and... (7 Replies)
Discussion started by: tdouty
7 Replies
expand(1)						      General Commands Manual							 expand(1)

NAME
expand, unexpand - Replaces tab characters with spaces or spaces with tab characters SYNOPSIS
Current syntax expand [-t tablist] [file...] unexpand [-a | -t tablist] [file...] Obsolescent syntax expand [-tabstop | -tab1,tab2,...,tabn] [file...] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: expand: XCU5.0 unexpand: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Replaces spaces at the beginning of each line with a tab, and inserts tab characters wherever their presence compresses the resultant file by replacing two or more characters. When the -t option is specified with the unexpand command, the -a option has no effect. (This option applies to the unexpand command only.) Specifies the tab stops. The tablist argument consists of a single positive decimal integer or multiple positive decimal integers, separated by spaces or commas, in ascending order. If a single number is specified, tabs are set tab- list column positions apart instead of the default (8). If multiple numbers are specified, tabs are set at those specific column posi- tions. Tabbing to tab stop position n thus causes the next character output to be in the (n+1)th column position on that line. If expand has to process a tab character at a position beyond the last of those specified in a multiple tab stop list, the tab char- acter is replaced by a single space in the output. Sets tab stops tabstop spaces apart instead of the default (8). (Obsolescent) Sets tab stops at specified columns. (Obsolescent) [Tru64 UNIX] Columns are measured in bytes. OPERANDS
The path name of a file to be processed. If you do not specify this operand, standard input is read. DESCRIPTION
The expand command changes tab characters to spaces in the named files, or the standard input, and writes the result to the standard out- put. The unexpand command puts tab characters into the data from the standard input, or the named files, and writes the result to the standard output. Backspace characters are preserved in the output and decrement the column count for tab calculations. The column position count cannot be decremented below one. The expand command is useful for preprocessing character files (before sorting, looking at specific columns, and so on.) that contain tab characters. By default, unexpand converts only spaces that are within sequences of spaces and tab characters at the beginnings of lines. Use -a to convert other sequences of spaces. NOTES
If the expand command encounters difficulties opening any specified file, it writes an error message to standard error and terminates imme- diately with an error status. If the unexpand command encounters difficulties opening any specified file, it writes an error message to standard error and continues operation. The exit status will reflect the error. EXIT STATUS
The following exit values are returned by either command: Successful completion. An error occurred. EXAMPLES
To replace tab characters in file with spaces, enter: expand file To replace the spaces in file with tab characters, enter: unexpand -a file ENVIRONMENT VARIABLES
The following environment variables affect the execution of expand and unexpand: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the inter- nationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non- empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: fold(1), tabs(1) Standards: standards(5) expand(1)
All times are GMT -4. The time now is 05:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy