Sponsored Content
Top Forums Shell Programming and Scripting To check the file and remove header before copying Post 302999247 by Don Cragun on Thursday 15th of June 2017 10:30:02 PM
Old 06-15-2017
Quote:
Originally Posted by rohit_shinez
Hi don,

Before I copy I need to change the source files which ends with _01.txt I.e. To remove the header
Fine. And, since you copy the modified source file to the destination (not move it), when you run your script again a few seconds (or an hour, or day, or week, or month, or year) later, it will update that same file again (this time removing a line of data instead of the header). And then it will copy the updated file again to its destination discarding a line of data there as well. And, after you have run your script enough times, your source and destination files will both be empty.

This doesn't seem like a logical way to handle things to me, but you can do it that way if you want to.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove header(first line) and trailer(last line) in ANY given file

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. UNIX for Dummies Questions & Answers

Copy all the files with time stamp and remove header,trailer from file

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)
Discussion started by: ksrams
35 Replies

3. Shell Programming and Scripting

Check file size and remove files

Hi, Here we have a situation where we have to check the file size and if the file size is greater than 0 bytes then remove the files from the directory. 1)EdwTrxn 2)EdwPost 3)EdwTndr 4)EdwSls 5)EdwSlsRej 6)EdwTndrRej Files will be created in the directory in the following manner. ... (5 Replies)
Discussion started by: srivsn
5 Replies

4. UNIX for Dummies Questions & Answers

Check header of file, without opening the file

if we happen to have a very big .csv file we cannot or dont care to edit, is there a way to check if the file contains a header row? (2 Replies)
Discussion started by: lydiaflamp
2 Replies

5. Shell Programming and Scripting

Copying the Header & footer Information to the Outfile.

Hi I am writing a perl script which checks for the specific column values from a file and writes to the OUT file. So the feed file has a header information and footer information. I header information isaround107 lines i.e. Starts with START-OF-FILE ....... so on .... ... (11 Replies)
Discussion started by: filter
11 Replies

6. Shell Programming and Scripting

Remove last few characters in a file but keeping Header and trailer intact

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

7. Shell Programming and Scripting

Remove the file content based on the Header of the file

Hi All, I want to remove the content based on the header information . Please find the example below. File1.txt Name|Last|First|Location|DepId|Depname|DepLoc naga|rr|tion|hyd|1|wer|opr Nava|ra|tin|gen|2|wera|opra I have to search for the DepId and remove the data from the... (5 Replies)
Discussion started by: i150371485
5 Replies

8. UNIX for Advanced & Expert Users

How to check or remove IP address from a hashed known_hosts file?which

Hi, In my server, the hostname and IP addresses are added to the known_hosts which then be hashed by ssh-keygen -H -f. Is it possible to check if an IP address has already been added to the hashed known_hosts to avoid duplications (I think there will be problems if there are duplicated IP... (3 Replies)
Discussion started by: hce
3 Replies

9. UNIX for Dummies Questions & Answers

Check for empty line at end of a dynamic header in each file

Hi Folks, I have a requirement to develop a shell script. PFB my requirement, Requirement: I need to check an empty line after the end of each header in respective file and if a empty line is present simply echo file OK and if empty line is not present echo "Adding empty line" and add an... (6 Replies)
Discussion started by: tpk
6 Replies

10. Shell Programming and Scripting

Find header in a text file and prepend it to all lines until another header is found

I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty. I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
3 Replies
gnomevfs-copy(1)						   User Commands						  gnomevfs-copy(1)

NAME
gnomevfs-copy - copy a file from one VFS location to another SYNOPSIS
gnomevfs-copy [-h] source-URI destination-URI DESCRIPTION
gnomevfs-copy copies a file from one URI location to another, using the virtual file system. OPTIONS
The following options are supported: -h Display usage and help information. OPERANDS
The following operands are supported: source-URI Specifies the source file location in standard URI format. destination-URI Specifies the destination file or directory location in standard URI format. EXAMPLES
Example 1: Copying a File From a Web Server to a Local File example% gnomevfs-copy http://www.sun.com file:///home/user/index.html ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gnomevfs-copy Executable to copy a file from one VFS location to another ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-vfs | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
gnomevfs-cat(1), gnomevfs-info(1), gnomevfs-ls(1), gnomevfs-mkdir(1) NOTES
Written by Stephen Browne, Sun Microsystems Inc., 2004. SunOS 5.10 6 Sep 2004 gnomevfs-copy(1)
All times are GMT -4. The time now is 12:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy