02-20-2009
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
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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
3. UNIX for Dummies Questions & Answers
Hi,
I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
Hi all,
I have source file, data looks like
12345 abc def 01 / 001200 C 2000
12345 abc def 01 / 001200 C 2500
12345 abcd def 01 / 001200 C 3500
18945 xyz pqr 01 / 009900 D 4000 5000 2800 9900
Expected ouput... (3 Replies)
Discussion started by: srk409
3 Replies
6. Shell Programming and Scripting
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
Input file:
xyz,pqrs.lmno,NA,NA,NA,NA,NA,NA,NA
abcd,pqrs.xyz,NA,NA,NA,NA,NA,NA,NA
Expected Output:
xyz pqrs.lmno NA NA NA NA NA NA NA
abcd pqrs.xyz NA NA NA NA NA NA NA
Command Tried so far:
awk -F"," 'BEGIN{OFS=" ";} {print}' $File_Path/File_Name.csv
Issue:... (5 Replies)
Discussion started by: TechGyaann
5 Replies
9. Shell Programming and Scripting
Hi,
I am wanting to create a script that will construct a SQL statement based on a a space delimited string that it read from a config file.
Example of the SQL will be
For example, it will read a string like "AAA BBB CCC" and assign to a variable named IN_STRING.
I then concatenate... (2 Replies)
Discussion started by: newbie_01
2 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
WC(1) BSD General Commands Manual WC(1)
NAME
wc -- word, line, and byte count
SYNOPSIS
wc [-c | -m] [-Llw] [file ...]
DESCRIPTION
The wc utility displays the number of lines, words, bytes and characters contained in each input file (or standard input, by default) to the
standard output. A line is defined as a string of characters delimited by a <newline> character, and a word is defined as a string of char-
acters delimited by white space characters. White space characters are the set of characters for which the iswspace(3) function returns
true. If more than one input file is specified, a line of cumulative counts for all the files is displayed on a separate line after the out-
put for the last file.
The following options are available:
-c The number of bytes in each input file is written to the standard output.
-L The number of characters in the longest line of each input file is written to the standard output.
-l The number of lines in each input file is written to the standard output.
-m The number of characters in each input file is written to the standard output.
-w The number of words in each input file is written to the standard output.
When an option is specified, wc only reports the information requested by that option. The default action is equivalent to all the flags
-clw having been specified.
The following operands are available:
file A pathname of an input file.
If no file names are specified, the standard input is used and no file name is displayed.
By default, the standard output contains a line for each input file of the form:
lines words bytes file_name
EXIT STATUS
The wc utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
iswspace(3)
COMPATIBILITY
Historically, the wc utility was documented to define a word as a ``maximal string of characters delimited by <space>, <tab> or <newline>
characters''. The implementation, however, didn't handle non-printing characters correctly so that `` ^D^E '' counted as 6 spaces, while
``foo^D^Ebar'' counted as 8 characters. 4BSD systems after 4.3BSD modified the implementation to be consistent with the documentation. This
implementation defines a ``word'' in terms of the iswspace(3) function, as required by IEEE Std 1003.2 (``POSIX.2'').
The -L option is a non-standard extension, compatible with the -L option of the GNU and FreeBSD wc utilities.
STANDARDS
The wc utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
BSD
February 18, 2010 BSD