07-23-2007
Thanks for quick reply Shell_Life.
Quote:
Originally Posted by
Shell_Life
Ksrams,
Please give us more information, such as sample of file name with the
timestamp and the expected output.
Here is the info.
Input file(s) located under directory /input and file names are:
1) input1_20070723_171556.txt
2) input2_20070723_171556.txt
3) input3_20070723-171556.txt
input1_20070723_171556.txt sample data:
HEADERRECORD 20070723 DESC
aaa 111 222 333 bbb
bbb 222 111 444 ccc
ccc 333 444 111 ddd
TRAILERRECORD 3
I want the do the following process in one script..
a) First thing is i want to copy all the files into /ouput directory
b) rename the files under /out directory to
1) rename input1_20070723_171557.txt file to input1.txt and also remove HEADERRECORD 20070723 DESC(header record i.e always first line) and TRAILERRECORD 3(Detail record i.e always last line in file) from input1.txt
input1.txt file data should be:
aaa 111 222 333 bbb
bbb 222 111 444 ccc
ccc 333 444 111 ddd
2) rename input2_20070723_171557.txt to input2.txt and also remove first and last lines from input2.txt
3) rename input3_20070723_171556.txt to input3.txt and also remove first and last lines from input3.txt
I hope this is much better compare to my previous post.
I would appreciate if you guide me on this..
Thanks in advance..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need some help in removing the header (first line) and the trailer (last line) in a give file...
The data file actually comes in EBCDIC format and I converted it into ASCII..
Now I need to strip off the first line and the last line..
I think we can use sed to do something like this:... (2 Replies)
Discussion started by: madhunk
2 Replies
2. Shell Programming and Scripting
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)
Discussion started by: oordonez
4 Replies
3. Shell Programming and Scripting
Hi,
Can any one tell me how to copy an alertlog file from a particular time stamp using shell script?
Thanks (3 Replies)
Discussion started by: suman_dba1
3 Replies
4. Shell Programming and Scripting
Hi All,
In my file i need to remove header and trailer records which comes in 1st line and last line respectively. After that i need to replace '$\|' with '$#@'.
I am using sed command for this and its taking lot of time. Is there any other command which can be used to improve performance?
... (1 Reply)
Discussion started by: HemaV
1 Replies
5. Shell Programming and Scripting
Hi All,
PFB is a requirement. I am new to shell scripting. So plz help. It would be highly appreciated.
1. choose all the log files based on a particular date (files location is '/test/domain')--i.e,we should choose all the files that are modified on 29th November, neither 28th nor 30th
2.... (3 Replies)
Discussion started by: skdas_niladri
3 Replies
6. UNIX for Dummies Questions & Answers
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)
Discussion started by: spari2
9 Replies
7. Shell Programming and Scripting
Hi All,
I am trying write a simple command using AWK and SED to this but without any success.
Here is what I am using:
head -1 test1.txt>test2.txt|sed '1d;$d' test1.txt|awk '{print substr($0,0,(length($0)-2))}' >>test2.txt|tail -1 test1.txt>>test2.txt
Input:
Header
1234567
abcdefgh... (2 Replies)
Discussion started by: nvuradi
2 Replies
8. Shell Programming and Scripting
Hi,
I need a script that validates a file header/detail/trailer. File layout is:
Header - Rec_Type|File_name|File_Date
Detail - Rec_Type|field1|field2|field3...
Trailder - Rec_Type|File_name|File_Date|Record_count
Sample Data:
HDR|customer_data.dat|20120709... (7 Replies)
Discussion started by: ash_sh
7 Replies
9. Shell Programming and Scripting
please see my requirement, I hope I am clear. (9 Replies)
Discussion started by: mirwasim
9 Replies
10. UNIX for Beginners Questions & Answers
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.
Header
row1
row2
row3
Trailer
The script should read all the files under... (3 Replies)
Discussion started by: phani333
3 Replies
LEARN ABOUT DEBIAN
afs-up
AFS-UP(1) AFS Command Reference AFS-UP(1)
NAME
up - Recursively copy directories, preserving AFS metadata
SYNOPSIS
up [-v] [-1] [-f] [-r] [-x] [-m]
<source directory> <destination directory>
DESCRIPTION
The up command recursively copies the files and subdirectories in a specified source directory to a specified destination directory. The
command interpreter changes the destination directory and the files and subdirectories in it in the following ways:
o It copies the source directory's access control list (ACL) to the destination directory and its subdirectories, overwriting any
existing ACLs.
o If the issuer is logged on as the local superuser root and has AFS tokens as a member of the group system:administrators, then the
source directory's owner (as reported by the "ls -ld" command) becomes the owner of the destination directory and all files and
subdirectories in it. Otherwise, the issuer's user name is recorded as the owner.
o If a file or directory exists in both the source and destination directories, the source version overwrites the destination version.
The overwrite operation fails if the first (user) "w" (write) mode bit is turned off on the version in the destination directory,
unless the -f flag is provided.
o The modification timestamp on a file (as displayed by the "ls -l" command) in the source directory overwrites the timestamp on a file
of the same name in the destination directory, but the timestamp on an existing subdirectory in the destination directory remains
unchanged. If the command creates a new subdirectory in the destination directory, the new subdirectory's timestamp is set to the time
of the copy operation, rather than to the timestamp that the subdirectory has in the source directory.
The up command is idempotent, meaning that if its execution is interrupted by a network, server machine, or process outage, then a
subsequent reissue of the same command continues from the interruption point, rather than starting over at the beginning. This saves time
and reduces network traffic in comparison to the UNIX commands that provide similar functionality.
The up command returns a status code of 0 (zero) only if it succeeds. Otherwise, it returns a status code of 1 (one).
This command does not use the syntax conventions of the AFS command suites. Provide the command name and all option names in full.
OPTIONS
-v Prints a detailed trace to the standard output stream as the command runs.
-1 Copies only the files in the top level source directory to the destination directory, rather than copying recursively through
subdirectories. The source directory's ACL still overwrites the destination directory's. (This is the number one, not the letter "l".)
-f Overwrites existing directories, subdirectories, and files even if the first (user) "w" (write) mode bit is turned off on the version
in the destination directory.
-m Recognize and copy mount points rather than traversing the volumes they reference during the recursive copy operation. Without -m,
up's default behavior is to copy the contents of all volumes and subvolumes mounted under the source directory into the volume
containing the destination directory.
-r Creates a backup copy of all files overwritten in the destination directory and its subdirectories, by adding a ".old" extension to
each filename.
-x Sets the modification timestamp on each file to the time of the copying operation.
source directory
Names the directory to copy recursively.
destination directory
Names the directory to which to copy. It does not have to exist already.
EXAMPLES
The following command copies the contents of the directory dir1 to directory dir2:
% up dir1 dir2
PRIVILEGE REQUIRED
The issuer must have the "a" (administer) permission on the ACL of both the source and destination directories.
COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas
Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.
OpenAFS 2012-03-26 AFS-UP(1)