Need to work in a file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need to work in a file
# 1  
Old 10-23-2012
Need to work in a file

I have a file like this:

Code:
00510010            0000000471           000000000482.90 000000005855.49

00510015            0000000471           000000002280.81 000000003093.79

00510020            0000000471           000000023640.82 000000022857.28

00510021            0000000471           000000003455.12 000000000000.00

00510025            0000000471           000000006464.03 000000019156.78

00510030            0000000471           000000017397.31 000000025120.67

00510035            0000000471           000000001247.54 000000000000.00

00510039            0000000471           000000000000.00 000000000000.00

00510040            0000000471           000000000528.05 000000004337.89

00510045            0000000471           000000022229.84 000000005599.31

00510047            0000000471           000000088763.88 000000072880.58

00510056            0000000471           000000006249.01 000000002815.64

00530070            0000000471           000000000000.00 000000000000.00


This is just a sample of the file, the file has more than 4 million lines. This is what I need:


1. I need the leading 0s in the 3rd and 4th column removed

2. When there is a 000000000000.00 I need to be replaced with just 0

3. I need the 4th column copied over 38 more times, so I would have 42 columns in total

4. I need the file eventually converted to .csv file with the space converted to commas
Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples!

Last edited by vgersh99; 10-23-2012 at 11:24 AM.. Reason: code tags, please!
# 2  
Old 10-23-2012
where exactly are you stuck in your implementation?
What exactly doesn't work?
# 3  
Old 10-23-2012
Am blank.. I dont think which one is going to... Give me a full code please.

---------- Post updated at 10:40 AM ---------- Previous update was at 10:34 AM ----------

Guys give me solution..
# 4  
Old 10-23-2012
Quote:
Originally Posted by Adhi
Am blank.. I dont think which one is going to... Give me a full code please.

---------- Post updated at 10:40 AM ---------- Previous update was at 10:34 AM ----------

Guys give me solution..
Please be advised that 'code leaching' is frown upon and discouraged in these forums.
Once the proper effort is shown by the OPs, the community will be more than happy to assist.
With that said - I'm closing the thread.
# 5  
Old 10-24-2012
Also, threads and posts where users request full solutions, then send PMs to the mods and admins to have their posts deleted, will not be deleted. Users who break their school or work place rules and policies are not tolerated in this forums, so do not send the mods and admins messages asking for your posts to be deleted.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies

2. Shell Programming and Scripting

My script work on Linux but not work in sunos.

My script work on Linux but not work in sun os. my script. logFiles="sentLog1.log sentLog2.log" intial_time="0 0" logLocation="/usr/local/tomcat/logs/" sleepTime=600 failMessage=":: $(tput bold)Log not update$(tput rmso) = " successMessage="OK" arr=($logFiles)... (7 Replies)
Discussion started by: ooilinlove
7 Replies

3. UNIX for Dummies Questions & Answers

How do unix file lenghts work?

Hello, Can someone tell me how unix works out file lenghts please? If I'm ftp'ing a file from a mvs mainframe to a unix box will the file be replicated line by line? I'm looking at the file on the unix box and it's telling me the recl is almost 4000 but it's not that on the mvs side. Should a... (3 Replies)
Discussion started by: Grueben
3 Replies

4. UNIX for Dummies Questions & Answers

How does $(<file) work?

If you enter " < myfile " on shell prompt directly, nothing to output. But for ' $(< myfile) ' , the contents of myfile replace $(< myfile). That has the same effect as ' $(cat myfile) '. I never seen such usage before and dont know how $(< myfile) work. Anyone can give some explanation? (1 Reply)
Discussion started by: hongwei
1 Replies

5. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies
Login or Register to Ask a Question