Sponsored Content
Full Discussion: Need to work in a file
Top Forums UNIX for Dummies Questions & Answers Need to work in a file Post 302719893 by Adhi on Tuesday 23rd of October 2012 10:22:55 AM
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!
 

5 More Discussions You Might Find Interesting

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

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

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

5. 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
URLENCODE(1)							  GridSite Manual						      URLENCODE(1)

NAME
urlencode - convert strings to or from URL-encoded form SYNOPSIS
urlencode [-m|-d] string [string ...] DESCRIPTION
urlencode encodes strings according to RFC 1738. That is, characters A-Z a-z 0-9 . _ and - are passed through unmodified, but all other characters are represented as %HH, where HH is their two-digit upper-case hexadecimal ASCII representation. For example, the URL http://www.gridpp.ac.uk/ becomes http%3A%2F%2Fwww.gridpp.ac.uk%2F urlencode converts each character in all the strings given on the command line. If multiple strings are given, they are concatenated with separating spaces before conversion. OPTIONS
-m Instead of full conversion, do GridSite "mild URL encoding" in which A-Z a-z 0-9 . = - _ @ and / are passed through unmodified. This results in slightly more human-readable strings but the application must be prepared to create or simulate the directories implied by any slashes. -d Do URL-decoding rather than encoding, according to RFC 1738. %HH and %hh strings are converted and other characters are passed through unmodified, with the exception that + is converted to space. EXIT CODES
0 is always returned. AUTHOR
Andrew McNab <Andrew.McNab@manchester.ac.uk> urlencode is part of GridSite: http://www.gridsite.org/ urlencode November 2003 URLENCODE(1)
All times are GMT -4. The time now is 11:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy