Three space delimited files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Three space delimited files
# 8  
Old 06-22-2011
Quote:
Originally Posted by evelibertine
However there is another issue. I want each row to correspond to a single line, now it splits rows into two lines. How do I format the file so that each row corresponds to a single line? Thanks a lot and sorry for the confusion! Smilie
It shouldn't do that either. Unless I'm just not getting your meaning.

My crystal ball is still in for maintenance so I can't tell what you're seeing from here. A sample of what your input and output data looks like would be really helpful. Also:

Quote:
show us what you actually typed, word for word, letter for letter, keystroke for keystroke. Use screenshots if necessary.
This User Gave Thanks to Corona688 For This Post:
# 9  
Old 06-22-2011
Screenshot 1 is 1a.txt. It has 90 rows and 200,000 columns in 90 lines.

Screenshot 2 is 2a.txt. It has 90 rows and 132512 columns in 90 lines.

I used paste 1a.txt 2a.txt > 3.txt

3.txt is screenshot 3 and has 90 rows and 332512 columns as expected, but 180 lines. How can I make 3.txt have 90 lines instead with each line corresponding to a row?
Three space delimited files-screenshotpng
Three space delimited files-screenshot-1png
Three space delimited files-screenshot-2png
# 10  
Old 06-22-2011
I said if necessary. Smilie You could've just copy-pasted sections in code tags.

nano says they're in DOS format, so they're all full of carriage returns. UNIX utilities will consider the carriage return as part of the line, but shells won't, causing strange effects when you view or operate on them.

Code:
tr -d '\r' < 1a.txt > 1b.txt
tr -d '\r' < 2a.txt > 2b.txt

paste 1b.txt 2b.txt > 3.txt

[edit] don't use sed to delete the carriage returns, use tr. That'll work no matter how big your lines are.

200,000 columns is a lot of columns. Some utilities might not work right on lines that big. What is your system?
This User Gave Thanks to Corona688 For This Post:
# 11  
Old 06-22-2011
Wow, thank you SO MUCH! That did the trick!!!! SmilieSmilieSmilie
# 12  
Old 06-22-2011
Quote:
Is there a way to fix it?
With GNU sed:

Code:
sed -i 's/\x0D$//' FILE1 FILE2 ...

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Space delimited variables

I have a shell script where I am using space delimited variables. Var=" ${var} data1 table1 " Var=" ${var} data2 table2 " Var=" ${var} data3 table3 " Var=" ${var} data4 table4 " I am using a single variable to store multiple values so I can use them in for loop. Each value contains space in... (1 Reply)
Discussion started by: srilaxman
1 Replies

2. Shell Programming and Scripting

Help/Advise please for converting space delimited string variable to comma delimited with quote

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

3. Shell Programming and Scripting

Remove space before numbers in delimited file

Hi, I have a file which looks like this FORD|1333-1| 10000100010203| 100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 I need the output to look like this FORD|1333-1|10000100010203|100040507697|0002|356.45|5555| SSSSY|KKKKM|1000005|10| N096|10043| C987 The leading... (8 Replies)
Discussion started by: wahi80
8 Replies

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

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. UNIX for Dummies Questions & Answers

Changing only the first space to a tab in a space delimited text file

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

7. Shell Programming and Scripting

How to convert a space delimited file into a pipe delimited file using shellscript?

Hi All, I have space delimited file similar to the one as shown below.. I need to convert it as a pipe delimited, the values inside the pipe delimited file should be as highlighted... AA ATIU2345098809 009697 005374 BB ATIU2345097809 005445 006518 CC ATIU9685098809 003215 003571 DD... (7 Replies)
Discussion started by: nithins007
7 Replies

8. UNIX for Dummies Questions & Answers

Combining three space delimited files by column

I have three space delimited files, how do I combine them by column in Unix? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

9. Shell Programming and Scripting

Merging files into a single tab delimited file with a space separating

I have a folder that contains say 50 files in a sequential order: cdf_1.txt cdf_2.txt cdf_3.txt cdf_3.txt . . . cdf_50.txt. I need to merge these files in the same order into a single tab delimited file. I used the following shell script: for x in {1..50}; do cat cdf_${x}.txt >>... (3 Replies)
Discussion started by: Lucky Ali
3 Replies

10. 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
Login or Register to Ask a Question