Sponsored Content
Top Forums Shell Programming and Scripting Help for reformatting text file and creating new format Post 302536584 by itkamaraj on Wednesday 6th of July 2011 12:18:51 AM
Old 07-06-2011
can you simply state your problem with some input file format and output file format.

---------- Post updated at 09:48 AM ---------- Previous update was at 09:20 AM ----------

Code:
 
lineno=`wc -l < inputfile`; nawk -F"," -v lineno="$lineno" '{ if (NR> lineno-10) {printf ("X%s %s%s%s %s X\n",$15,$13,$12,$11,$9)}}' inputfile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Creating a file in variable length format

Hi all, Does anyone know a technique for creating a download file in variable length format? I have looked around but haven't found any resources on this (or, maybe I'm not sure what to Google for :) ) Thanks in advance! (2 Replies)
Discussion started by: Sarahb29
2 Replies

2. Shell Programming and Scripting

Creating a text file in Local Drive

Hi All, I am new in Shell Script. I have a ksh script running in the Unix Server and basically in that script I need to create a text file but the text file has to be generated in the local PC (the user computer such as in C:\ drive). I have no idea on how to do it and I need it pretty urgently.... (2 Replies)
Discussion started by: yramli
2 Replies

3. Homework & Coursework Questions

creating search script for a text file

I am aware of the stipulations regarding homework, however I am completely stuck and do not know how to even begin the following (in bash): Create a script that searches for a text file with most occurrences of a given keyword. Any help is greatly appreciated. Thank you (1 Reply)
Discussion started by: hybridoutlaw
1 Replies

4. Shell Programming and Scripting

Help with creating a text file in perl with file creation date.

Hi, I am quite new to Perl scripting and i need to create a .TXT file using perl, with fields (A,B,C,D,E), and this text file should be named with current file creation date "XYZ_CCYYMMDD.TXT" (i.e.XYZ_2011042514:33 PM). Can anyone who has done this, please share their expertise on this... (5 Replies)
Discussion started by: msrahman
5 Replies

5. UNIX for Dummies Questions & Answers

creating text file with content from script

hi, can somebody tell me how I can create a text file with content from Bash script. The file should be prefilled with information such as current date and time then leaving the user ability to input more data right below those prefilled content. thank you :) (0 Replies)
Discussion started by: s3270226
0 Replies

6. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

7. Shell Programming and Scripting

Help in creating a text file

Hi, I need help in creating a file in specific format. I have following lines in a file 0772 0ECC 0FC8 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 (6 Replies)
Discussion started by: jpkumar10
6 Replies

8. Shell Programming and Scripting

Reformatting single column text file starting new line when finding particular string

Hi, I have a single colum file and I need to reformat the file so that it creates a new line every time it come to an IP address and the following lines are corresponding rows until it comes to the next IP address. I want to turn this 172.xx.xx.xx gwpusprdrp02_pv seinwnprd03... (7 Replies)
Discussion started by: kieranfoley
7 Replies

9. Shell Programming and Scripting

crontab not creating text file

while running the following code in ssh crontab, Its running successfully but its not creating text file IFC1.txt, file1.txt, file2.txt while running manually its working. please help me #!/bin/ksh hostname > file1.txt 2>/dev/null hostname >> file1.txt 2>/dev/null sudo df -h | grep... (2 Replies)
Discussion started by: elango963
2 Replies

10. Shell Programming and Scripting

Need help in creating a file in required format form another existing file

I have a text file with contents like this: a,b,c, d~e,f,g,h~i,j ,k,l,m~n,o,p,q~ I need to convert this file into this format unix shell script commands: a,b,c,d~ e,f,g,h~ i,j,k,l,m~ n,o,p,q~ as you may have noticed, I need to retain the ~ signs at the end. Any help is greatly... (3 Replies)
Discussion started by: harsha1238
3 Replies
DPKG::Log::Entry(3pm)					User Contributed Perl Documentation				     DPKG::Log::Entry(3pm)

NAME
DPKG::Log::Entry - Describe a log entry in a dpkg.log VERSION
version 1.20 SYNOPSIS
use DPKG::Log::Entry; $dpkg_log_entry = DPKG::Log::Entry->new( line => $line, $lineno => 1) $dpkg_log_entry->timestamp($dt); $dpkg_log_entry->associated_package("foo"); DESCRIPTION
This module is used to describe one line in a dpkg log by parameterizing every line into generic parameters like o Type of log entry (startup-, status-, action-lines) o Timestamp o Subject of log entry (e.g. package, packages or archives) o Package name (if log entry refers to a package subject) and so on. The various parameters are described below together with the various methods to access or modify them. METHODS
$dpkg_log_entry = PACKAGE->new( 'line' => $line, 'lineno' => $lineno ) Returns a new DPKG::Log::Entry object. The arguments line and lineno are mandatore. They store the complete line as stored in the log and the line number. Additionally its possible to specify every attribute the object can store, as 'key' => 'value' pairs. ATTRIBUTES
$dpkg_log_entry->line() / line Return the full log line. This attribute is set on object initialization. $dpkg_log_entry->lineno() / lineno Return the line number of this entry. This attribute is set on object initialization. $dpkg_log_entry->timestamp() / timestamp Get or set the timestamp of this object. Should be a DateTime object. $dpkg_log_entry->type() / type Get or set the type of this entry. Specifies weither this is a startup, status or action line. $dpkg_log_entry->associated_package() / associated_package Get or set the associated_package of this entry. This is for lines that are associated to a certain package like in action or status lines. Its usually unset for startup and status lines. $dpkg_log_entry->action() / action Get or set the action of this entry. This is for lines that have a certain action, like in startup-lines (unpack, configure) or action lines (install, remove). It is usally unset for status lines. $dpkg_log_entry->status() / status Get or set the status of the package this entry refers to. $dpkg_log_entry->subject() / subject Gets or Defines the subject of the entry. For startup lines this is usually 'archives' or 'packages' for all other lines its 'package'. $dpkg_log_entry->installed_version() / installed_version Gets or Defines the installed_version of the package this entry refers to. It refers to the current installed version of the package depending on the current status. Is "<none>" (or similar) if action is 'install', old version in case of an upgrade. $dpkg_log_entry->available_version() / available_version Gets or Defines the available_version of the package this entry refers to. It refers to the currently available version of the package depending on the current status. Is different from installed_version if the action is install or upgrade. $dpkg_log_entry->conffile() / conffile Get or set a conffile for a line indicating a conffile change. $dpkg_log_entry->decision() / decision Gets or defines the decision for a line indicating a conffile change. SEE ALSO
DateTime AUTHOR
Patrick Schoenfeld <schoenfeld@debian.org>. COPYRIGHT AND LICENSE
Copyright (C) 2011 Patrick Schoenfeld <schoenfeld@debian.org> This library is free software. You can redistribute it and/or modify it under the same terms as perl itself. perl v5.10.1 2011-02-23 DPKG::Log::Entry(3pm)
All times are GMT -4. The time now is 08:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy