please rectify my problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting please rectify my problem
# 1  
Old 12-22-2005
Question please rectify my problem

Dear Friends,

I have two data file containing 4 coloums.

my first file has data like this

ex:
file1:
2.56 66.82 ***
2.56 66.82 ***
2.54 66.84 ***
2.54 66.84 ***
2.51 66.84 ***
2.51 66.84 ***
2.51 66.86 ***
2.49 66.86 ***
2.47 66.86 ***
2.45 66.84 ***
2.44 66.86 ***

and second file having the data like this

2.56 66.82 24.2
2.56 66.82 23.6
2.54 66.84 22.1
2.54 66.84 28.1
2.51 66.84 72.3
2.51 66.84 ***
2.51 66.86 ***
2.49 66.86 ***
2.47 66.86 ***
2.45 66.84 ***
2.44 66.86 ***

now my problem starts

now i want to add second file last coloum to my first file as a last coloum .

in both files first two coloums are same.

now how to add second file last coloum to first file as a last coloum

I think awk can solve my problem.

but i dont know how to write it.

please help me


thanks & regards
rajan


# 2  
Old 12-22-2005
It is just a matter of cut and paste.
Code:
cut -d' ' -f3 file2.lst | paste file1.lst -

# 3  
Old 12-22-2005
dear friend,

your code has not working
# 4  
Old 12-22-2005
"not working" does not explain the error. What is the error that you are getting? Post the command that you are running, the output that you are getting and the output that you expect.
# 5  
Old 12-22-2005
cut -d' ' -f3 2.txt |paste 1.txt -


2.56 66.82 *** 24.2
2.56 66.82 *** 23.6
2.54 66.84 *** 22.1
2.54 66.84 *** 28.1
2.51 66.84 *** 72.3
2.51 66.84 *** ***
2.51 66.86 *** ***
2.49 66.86 *** ***
2.47 66.86 *** ***
2.45 66.84 *** ***
2.44 66.86 *** ***


the above command gives the result u desired

Last edited by vishnu_vaka; 12-22-2005 at 04:22 AM..
# 6  
Old 12-22-2005
Thank u vishnu_vaka your script is working fine.

please provide solution to this problem also.

after running the above script the output is like this.


2.56 66.82 *** 24.2
2.56 66.82 23.6 23.6
2.54 66.84 23.6 22.1
2.54 66.84 *** 28.1
2.51 66.84 *** 72.3
2.51 66.84 *** ***
2.51 66.86 *** ***
2.49 66.86 *** ***
2.47 66.86 *** ***
2.45 66.84 *** ***
2.44 66.86 *** ***

Now I want to delete lines where the third coloum has no data.
ie I want the data where the third coloum has not null.

like this
2.56 66.82 23.6 23.6
2.54 66.84 23.6 22.1

how to get this

please help

regards
rajan



# 7  
Old 12-22-2005
vishnu_vaka's code is the same as what I had posted. I still cannot get how you got an error while running it. But to answer your last question,
Code:
cut -d' ' -f3 <name of second file> | paste <name of first file> -|awk '$3 !~ /\*\*\*/ {print}'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

Router problem or ISP problem ?

Hi everyone, I am experiencing discontinuity of Internet service, this started 1 month ago. Everything worked very well for 1 year of intensive use, but now, I have problems reaching my gateway. The gateway is not my router but a node belonging to my ISP and I share the same public IP with... (3 Replies)
Discussion started by: remic
3 Replies

2. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies

3. IP Networking

Problem with forwarding emails (SPF problem)

Hi, This is rather a question from a "user" than from a sys admin, but I think this forum is apropriate for the question. I have an adress with automatic email forwarding and for some senders (two hietherto), emails are bouncing. This has really created a lot of problems those two time so I... (0 Replies)
Discussion started by: carwe
0 Replies

4. AIX

AIX OS problem? network problem?

Dear ALL. I installed AIX OS on customer sites. but Only one site is too slow when I connected telnet, ftp.. Ping is too fast. but telnet and FTP is not connected.. of course i check the configuration file on aix but it's normal. Do any Idea?? thanks in advance. - Jun - (3 Replies)
Discussion started by: Jeon Jun Seok
3 Replies

5. UNIX for Dummies Questions & Answers

DHCP problem and eth1 problem

At work I am trying to get this one Linux machine (let's call it ctesgm07) to behave like another Linux machine that we have (let's call it test007). test007 returns the following version info: cat /etc/debian_version: lenny/sid uname -a: Linux test007 2.6.27-7-generic #1 SMP Tue Nov 4... (0 Replies)
Discussion started by: sllinux
0 Replies

6. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

7. Linux

how to rectify the MS Office problem

Dear forum members, I was configured smb ldap in fedora core 6, past 1 year its running nice with out any problem. but last one week I can't able to save microsoft office application(excel) in server. server having a sufficient memory(2Gb RAM). this problem only for ms application. how can i... (4 Replies)
Discussion started by: erbalamurugan
4 Replies

8. Solaris

problem in finding a hardware problem

Hi I am right now facing a strange hardware problem. System get booted with the following error: Fatal Error Reset CPU 0000.0000.0000.0003 AFSR 0100.0000.0000.0000 SCE AFAR 0000.07c6.0000.1000 SC Alert: Host System has Reset It happen 4 or 5 times and get the same error every time.I... (8 Replies)
Discussion started by: girish.batra
8 Replies

9. Shell Programming and Scripting

On comparing two number getting error,not able to rectify it pplease help

temp=`cat /gcdm/prd/rawdata/LCDM_FR_CCF_00003_D_CARM | head -1 | cut -c 19-27` temp= `expr $temp - 1` for file in `ls /gcdm/prd/archive*/carm/LCDM_FR_CCF_00003_D_CARM/*.gz` do seq_no=`gunzip -c $file | head -1 | cut -c 19-27` if then echo found; fi done this is code I am using... (2 Replies)
Discussion started by: moh_hak_786
2 Replies

10. Shell Programming and Scripting

problem with dd command or maybe AFS problem

Hi, folks. Sorry for bothering, but maybe someone could help me please. The problem is the following: there is some script that copies files from local file system to AFS. The copying is performed with dd command. The script copies data into some AFS volumes. The problem appeared with one... (0 Replies)
Discussion started by: Anta
0 Replies
Login or Register to Ask a Question