Unix Shell scripting, removing hex 0d 0a


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unix Shell scripting, removing hex 0d 0a
# 8  
Old 12-30-2010
Hi guys, thanks a lot for your response. Let me tell you the complete requirement:
File 1:
111,10
112,20
113,30
114,40

File 2:
111,51,jklfsdfj
dkfld
111,52,dadfdl das
112,53,ewuei ewi ewop
wqopie ew
112,54,aaa aa[1] qq
113,55,ee ee[4] rr[6]
ew 1
ewe 4

My task is to produce the output as:
10 jklfsdfj dkfld dadfdl das
20 ewuei ewi ewop wqopie ew aaa aa[1] qq
30 ee ee[4] rr[6] ew 1 ewe 4
That is, whenever column1 of file1 matches with column1 of file2,
output has to be column2 of file1 and column3 of file2 corresponding to this match.
Hence I used join. Like this:
join -1 1 -2 1 -o 1.2 2.3 file1 file2 >file3
But the output is errorneous since file2 has data not in a pattern.

@ludwig : thank you. But i need the code in shell scripting.
# 9  
Old 12-30-2010
Please show carriage-return and line-feed characters in the before and after examples. If you are dealing with a non-unix format text file it will require special techniques.
# 10  
Old 12-30-2010
Quote:
Originally Posted by methyl
Very strange request.
<snip>
On MacOSs, the end-of-line character is \r, only.
Or this may be for some legacy app.
Stranger things have happened.
# 11  
Old 12-30-2010
@m.d.ludwig
Hmm. I specialise in data conversion.
Unfortunately the O/P has not revealed the file format, the Operating System or any consistent data samples.
This thread is going nowhere fast.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX Shell Scripting

Describe in short the word completion feature of the tcsh Completion works anywhere in the command line, not at just the end, for both commands and filenames. Type part of a word and hit the Tab key, and the shell replaces the incomplete word with the complete one in the input buffer. The... (1 Reply)
Discussion started by: Elena Lauren
1 Replies

2. Programming

unix Shell scripting

Hi All, need help to complete the automation but stuck at a perticular situation below is the code <code> fixed_function_name { code.... code.... variable_map= { a="/a" b="/b" c="/c" so on... } (7 Replies)
Discussion started by: yadavricky
7 Replies

3. UNIX for Dummies Questions & Answers

Unix Shell Scripting

I'm sorry if this doesn't go here, but I'm in depserate need of help with my last unix homework. Anyways, I'm taking summer classes, and one of them is UNIX. I've understood everything thus far, but I'm having a killer time with how my instructor has worded the problems for shell scripting. I... (3 Replies)
Discussion started by: dw15
3 Replies

4. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies

5. Shell Programming and Scripting

Unix shell scripting

Hi All, I have one file called date1.txt and it contains dates like 130112 140112 150112 160112 170112 180112 190112 201012 so i need a script to read this file line by line and find out the day of each date and assign this value in one variable. And validate Weekday="Mon" then... (4 Replies)
Discussion started by: vichuelaa
4 Replies

6. Shell Programming and Scripting

Removing the entire file contents using unix shell script.

I need to remove the entire file contents in file using the shell script. Actually the grap -v command will create one more file and it occupy the space also. I need to remove the entire file contents without creating new file using the shell scripting. Please help me. (5 Replies)
Discussion started by: praka
5 Replies

7. UNIX for Advanced & Expert Users

Need your Help on Unix Shell Scripting.........

Hi Friends, 1. Bash Shell Scrpt to take backup at evening 2. I need a bash shell script for killing all processes. (5 Replies)
Discussion started by: vinayraj
5 Replies

8. Shell Programming and Scripting

Unix shell scripting

Hi, we are writing this fields dynamically retrieved from database and writing into the file. $bmpRec = $bmpRec.'|'.$cust_id; # sp4 $bmpRec = $bmpRec.'|'.$serv_id; # sp5 $bmpRec = $bmpRec.'|'.$site_id; # sp6 $bmpRec = $bmpRec.'|'.$loc_id; # sp7 ... (4 Replies)
Discussion started by: Maruthi Kunnuru
4 Replies

9. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

10. UNIX for Dummies Questions & Answers

Unix shell scripting

I need to write a script which analyses an invoice file, counting the amount of pages in the file to be printed per account number and per invoice. The account numbers are stored in another file which has instructions on what do with ach customers invoice as per their account number. please... (6 Replies)
Discussion started by: la_burton
6 Replies
Login or Register to Ask a Question