Append pipe | at the end of all the rows except header n trailer for all the files under a directory
Hi Experts
Need help...
I am looking for a Unix script to append pipe | at the end of all the rows (except header and trailer)in all the files placed under the directory /interfaces/Temp
e.g.
The script should read all the files under /interfaces/Temp and append | at the end of rows (except header and trailer).
Post execution of Script, all files under the folder should look like this:
Thanks
Phani
Moderator's Comments:
Use code tags please.
Last edited by Peasant; 09-27-2019 at 12:55 AM..
Reason: Added code tags
All,
I am new to unix and i have the following requirement.
I have file(s) landing into input directory with timestamp, first i want to copy all these files into seperate directory then i want to rename these files without timestamp and also remove header,trailer from that file..
Could... (35 Replies)
Hi everyone,
I am new to Unix programming. My inquries is:-
a) How to add a Header and Trailer in the set of data
b) Include a number count of the data in the trailer
The set of data only contained the information of 'Customer's Name' and 'Account Number'. I would like to add the Header... (2 Replies)
How to append constant No of spaces suppose 52 at end of each line in a file (xyz) excluding first and last line.
Please Help me out for the same. (1 Reply)
Situation:
Our system currently executes a job (COBOL Program) that generates an interface file to be sent to one of our vendors. Because this system processes information for over 100,000 employees/retirees (and growing), we'd like to multi-thread the job into processing-groups in order to... (4 Replies)
Hi,
I have a command "get_data" with some parameters in few *.text files of a directory. I want to first find those files that contain this command and then append the following parameter to the end of the command.
example of an entry in the file :-
get_data -x -m50 /etc/web/getid
this... (1 Reply)
i have .DAT file FILE1.DAT
1200910270040625
2123456789 J123456 ABC
2123456789 K123456 ABC
2222222222 L123456 DEF
2333333333 M12345 GHI
30000004
My outfile FILE2.TXT should have like this, I need the header value as ie (1200910270040625 ) body rows remove the duplicate rows and the... (2 Replies)
Hi,
I want to add the below Header to all the files in sequence File1,File2,File3...etc
"ABC,<number of chracter in the file>"
e,g - If File1 is as below
pqrstuvdt
abcdefgh
then I want to add the above header into it ,So that File1 becomes as below
ABC,17
pqrstuvdt
abcdefgh
... (9 Replies)
Hi ,
My UNIX system is SUN Solaris.
I am trying to do a simple thing as described below.
I have a PIPE delimited file that has header and trailer. So the file is something like below:
Test1.txt looks like something below:
field_data1|field_data2|and some more data --Header
... (5 Replies)
I am planning to automate multiple files through Unix script.
Could you please guide for making the automation for multiple files ?
Eg.
I have to check header and footer for all files in the particular path and the header pattern should match with the filename.
Filename- Filename.txt... (2 Replies)
Discussion started by: karthick2020333
2 Replies
LEARN ABOUT REDHAT
dbi::format
DBI::Format(3) User Contributed Perl Documentation DBI::Format(3)NAME
DBI::Format - A package for displaying result tables
SYNOPSIS
# create a new result object
$r = DBI::Format->new('var1' => 'val1', ...);
# Prepare it for output by creating a header
$r->header($sth, $fh);
# In a loop, display rows
while ($ref = $sth->fetchrow_arrayref()) {
$r->row($ref);
}
# Finally create a trailer
$r->trailer();
DESCRIPTION
THIS PACKAGE IS STILL VERY EXPERIMENTAL. THINGS WILL CHANGE.
This package is used for making the output of DBI::Shell configurable. The idea is to derive a subclass for any kind of output table you
might create. Examples are
o a very simple output format as offered by DBI::neat_list(). "AVAILABLE SUBCLASSES".
o a box format, as offered by the Data::ShowTable module.
o HTML format, as used in CGI binaries
o postscript, to be piped into lpr or something similar
In the future the package should also support interactive methods, for example tab completion.
These are the available methods:
new(@attr)
new(\%attr)
(Class method) This is the constructor. You'd rather call a subclass constructor. The construcor is accepting either a list of
key/value pairs or a hash ref.
header($sth, $fh)
(Instance method) This is called when a new result table should be created to display the results of the statement handle $sth. The
(optional) argument $fh is an IO handle (or any object supporting a print method), usually you use an IO::Wrap object for STDIN.
The method will query the $sth for its NAME, NUM_OF_FIELDS, TYPE, SCALE and PRECISION attributes and typically print a header. In
general you should not assume that $sth is indeed a DBI statement handle and better treat it as a hash ref with the above
attributes.
row($ref)
(Instance method) Prints the contents of the array ref $ref. Usually you obtain this array ref by calling
$sth->fetchrow_arrayref().
trailer (Instance method) Once you have passed all result rows to the result package, you should call the trailer method. This method can,
for example print the number of result rows.
AVAILABLE SUBCLASSES
First of all, you can use the DBI::Format package itself: It's not an abstract base class, but a very simple default using
DBI::neat_list().
Ascii boxes
This subclass is using the Box mode of the Data::ShowTable module internally. Data::ShowTable(3).
Raw
Row is written without formating. Columns returned in comma or user defined separated list.
String
Row is written using a string format. Future releases will include th ability set the string format.
AUTHOR AND COPYRIGHT
This module is Copyright (c) 1997, 1998
Jochen Wiedmann
Am Eisteich 9
72555 Metzingen
Germany
Email: joe@ispsoft.de
Phone: +49 7123 14887
The DBD::Proxy module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO DBI::Shell(3), DBI(3), dbish(1)perl v5.8.0 2002-11-29 DBI::Format(3)