Sponsored Content
Full Discussion: Clean File
Top Forums UNIX for Advanced & Expert Users Clean File Post 302090855 by anbu23 on Wednesday 27th of September 2006 06:05:51 PM
Old 09-27-2006
Code:
awk ' 
/BeginDate/ {
getline end_dt
getline cust
getline cust1
sub(".* ","",$0)
bgn_dt=$0
sub(".*: ","",end_dt)
sub(".*: ","",cust)
if ( match ( cust1 , "^[0-9][0-9]*" ) )
        print $0 " " end_dt " " cust " " cust1
else
{
        cust = cust cust1
}
}
/^[0-9]+/{
print bgn_dt " " end_dt " " cust " " $0 }' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Clean file in single action

What one finds challenging another finds simple... (HPUX B.11.11) I have a text file named something like 12345.dst that could look like this: DOG CAT NONE TEST CAT What I want to end up with is 12345.dst looking like this: CAT DOG TEST removing "NONE" should it be there and... (1 Reply)
Discussion started by: djp
1 Replies

2. UNIX for Advanced & Expert Users

Clean Text File

HI, I have a file which comes from crystal reports in the below format. I need to clean the file so that i will only have the columns(deptid,empid,ename,sal) and the data below the column names. There is a bug in the repoting tool( we only see page1-1 for every department).The rundate change... (1 Reply)
Discussion started by: kris01752
1 Replies

3. AIX

How to clean PV id?

When I run command: >chdev -l hdisk1 -a pv=clear It shows Method error (/etc/methods/chgdisk): 0514-062 Cannot perform the requested function because the specified device is busy. run: #>fuser -kxuc /dev/raw1 /dev/raw1: How to clean PV id? (4 Replies)
Discussion started by: rainbow_bean
4 Replies

4. UNIX for Dummies Questions & Answers

Clean directories by reading from file

I have a file in following format directory1=/out/log purgedays1=4 extn1=log,out,txt directory2=/clean/log purgedays2=4 extn2=log,out now i need need to create a script that reads this file and cleans all the files with the given extn from the given directory. The catch here is that... (2 Replies)
Discussion started by: max_payne1234
2 Replies

5. UNIX for Advanced & Expert Users

Unable to clean up file system

Hi, Has anyone ever encountered the following scenario: I am working on a SUN server with solaris 10 installed and veritas managing the filesystem. One of the file systems has become full: df -kh /ossrc/dbdumps Filesystem size used avail capacity Mounted on... (6 Replies)
Discussion started by: eeidel
6 Replies

6. UNIX for Dummies Questions & Answers

command to clean up file systems

As you will verify, I am a really naive user of AIX 5.1. As such I wonder if you could possibly let me know of a command or procedure I could use to automatically, globally and safely, remove all useless files from my machine. I'm not referring to my own files because I perfectly know which of them... (1 Reply)
Discussion started by: ahjchr
1 Replies

7. Shell Programming and Scripting

clean passwd file based on db table (master)

The purpose of this script is to scan the /etc/passwd file one line at a time comparing the usernames to the usernames found in a database table. I will later locked every account which is not in the database table. I have export the userlist from the database in a file (/tmp/userlist). It... (1 Reply)
Discussion started by: Banks187
1 Replies

8. UNIX for Advanced & Expert Users

Clean console output routed to a file

A friend routed some console output to a file for me. The problem is he used backspace and escape sequences all over the place. Using vi to view the file makes it difficult to read. Is there a program that will process the backspaces and remove the escape sequences? e.g., bash-3.00$ pwd^ (5 Replies)
Discussion started by: eddyq
5 Replies

9. Shell Programming and Scripting

[SOLVED] help clean up file movement script

Hello Group, Once again another script hacked together from a few sources to try and suit my needs. This is to go through a /temp directory and for each ls entry ask which Dir of three I want it sorted. The script works but there are a few behaviors that are odd so I figured I'd ask for help... (2 Replies)
Discussion started by: dpreviti
2 Replies

10. UNIX for Beginners Questions & Answers

awk to clean up input file, printing both fields

In the f1 file below I am trying to clean it up removing lines the have _tn_ in them. Next, removing the characters in $2 before the ninth /. Then I remove the ID_(digit- always 4). Finally, the charcters after and including the first _. It is curently doing most of it but the cut is removing $1... (5 Replies)
Discussion started by: cmccabe
5 Replies
PPI::Token::End(3pm)					User Contributed Perl Documentation				      PPI::Token::End(3pm)

NAME
PPI::Token::End - Completely useless content after the __END__ tag INHERITANCE
PPI::Token::End isa PPI::Token isa PPI::Element DESCRIPTION
If you've read PPI::Token::Whitespace, you should understand by now the concept of documents "floating in a sea of PPI::Token::Whitespace". Well it doesn't after the __END__ tag. Once you __END__, it's all over. Anything after that tag isn't even fit to be called whitespace. It just simply doesn't exist as far as perl (the interpreter) is concerned. That's not to say there isn't useful content. Most often people use the __END__ tag to hide POD content, so that perl never has to see it, and presumably providing some small speed up. That's fine. PPI likes POD. Any POD after the __END__ tag is parsed into valid PPI::Token::Pod tags as normal. This class, on the other hand, is for "what's after __END__ when it isn't POD". Basically, the completely worthless bits of the file :) METHODS
This class has no method beyond what is provided by its PPI::Token and PPI::Element parent classes. SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.10.1 2011-02-26 PPI::Token::End(3pm)
All times are GMT -4. The time now is 04:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy