Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Add line with data to existing file Post 302285273 by fletcher on Sunday 8th of February 2009 08:57:38 AM
Old 02-08-2009
where data come from

the data will come from the user, the user will input the data from the bash.
there is an existing file called appointments with colummn 3 headings saperated by tabs date time venue

what i want is the user to append data to that file by typing an executable file first called addfile followed by parameters 24/12/78 14.04 newyork eg.
$ addfile 14/12/78 14.04 newyork

to produce a file like this:
date time venue
14/12/78 14.04 newyork

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to add a line of data to already existing file in Unix..

Hello.. I have a text file with 100 lines of data. I need to add 1 line of data to that already existing file at the first line( beginning of the file) , so that the already existing 100 lines will start from 2 nd line.Now the file will have 101 lines of data. Help me on how to add the line... (4 Replies)
Discussion started by: charan81
4 Replies

2. UNIX for Dummies Questions & Answers

add data from command line to end of file

how can I add data from command line to end of file? (3 Replies)
Discussion started by: bryan
3 Replies

3. Shell Programming and Scripting

Need Help for Adding Three new columns in existing file from fatching data from file

not required this time (36 Replies)
Discussion started by: Sandeep_Malik
36 Replies

4. Shell Programming and Scripting

add more data to existing data in a file

Hi all, I need help to add additional data from file2 to existing data in file 1 using awk, sed or perl. the ID in file 1 should match against field $3 in file2 file1 #this is a new game ID HR_1 BASE1 30 BASE2 37 DETAIL No TYPE L @@ ID HR_10 BASE1 6030 BASE2 ... (4 Replies)
Discussion started by: redse171
4 Replies

5. Ubuntu

How to add a data column in existing file

Hi All I need to add a column on my existing data file. I know similar posts are there but none of them were meeting my requirement. My input is 1.20 3.44 4.88 5.11 4.99 3.22 1.89 3.89 2.90 Desired output 1 1.20 3.44 4.88 2 5.11 4.99 3.22 3 1.89 3.89 2.90 I will... (2 Replies)
Discussion started by: mahbub03
2 Replies

6. Shell Programming and Scripting

create txt file form data file and add some line on it

Hi Guys, I have file A.txt File A Data AK1521 AK2536 AK3164 I want create text file of all data above and write some data on each file. want Output on below folder /home/kka/out AK1521.txt Hi Welocme (3 Replies)
Discussion started by: asavaliya
3 Replies

7. Shell Programming and Scripting

Generate tabular data based on a column value from an existing data file

Hi, I have a data file with : 01/28/2012,1,1,98995 01/28/2012,1,2,7195 01/29/2012,1,1,98995 01/29/2012,1,2,7195 01/30/2012,1,1,98896 01/30/2012,1,2,7083 01/31/2012,1,1,98896 01/31/2012,1,2,7083 02/01/2012,1,1,98896 02/01/2012,1,2,7083 02/02/2012,1,1,98899 02/02/2012,1,2,7083 I... (1 Reply)
Discussion started by: himanish
1 Replies

8. Shell Programming and Scripting

Recoding data in a matrix from an existing file

Hi, I was wondering if someone would be able to help with extrapolating information from a file and filling an existing matrix with that information. I have made a matrix like this (file 1): A B C D 1 2 3 4 I have another file with data like this (file 2): 1 A 1 C 3 C 4 B... (1 Reply)
Discussion started by: hubleo
1 Replies

9. Shell Programming and Scripting

Help with add existing file name as new data column in new output file

Input File 1 cat S1.txt MI0043 2731 miR-1 Input File 2 cat S4.txt MI006 310 CiR-1 MI057 10 CiR-24 MI750 5 CiR-24 Desired Output File 1 cat S1.txt.out MI0043 2731 miR-1 S1.txt Desired Output File 2 cat S4.txt.out MI006 310 CiR-1 S4.txt (3 Replies)
Discussion started by: perl_beginner
3 Replies

10. Shell Programming and Scripting

How to add new line after every data inserted to file?

Hi all, I need help for solve my problem. my problem is like this.. i want to add many word to file. but after I add 1 word, the second word should be in the under of the first word. i have tried but the result is like this word1word2word3 i want the result to be like this word1 word2... (5 Replies)
Discussion started by: weslyarfan
5 Replies
SHA1(3) 						User Contributed Perl Documentation						   SHA1(3)

NAME
Digest::SHA1 - Perl interface to the SHA-1 algorithm SYNOPSIS
# Functional style use Digest::SHA1 qw(sha1 sha1_hex sha1_base64); $digest = sha1($data); $digest = sha1_hex($data); $digest = sha1_base64($data); $digest = sha1_transform($data); # OO style use Digest::SHA1; $sha1 = Digest::SHA1->new; $sha1->add($data); $sha1->addfile(*FILE); $sha1_copy = $sha1->clone; $digest = $sha1->digest; $digest = $sha1->hexdigest; $digest = $sha1->b64digest; $digest = $sha1->transform; DESCRIPTION
The "Digest::SHA1" module allows you to use the NIST SHA-1 message digest algorithm from within Perl programs. The algorithm takes as input a message of arbitrary length and produces as output a 160-bit "fingerprint" or "message digest" of the input. In 2005, security flaws were identified in SHA-1, namely that a possible mathematical weakness might exist, indicating that a stronger hash function would be desirable. The Digest::SHA module implements the stronger algorithms in the SHA family. The "Digest::SHA1" module provide a procedural interface for simple use, as well as an object oriented interface that can handle messages of arbitrary length and which can read files directly. FUNCTIONS
The following functions can be exported from the "Digest::SHA1" module. No functions are exported by default. sha1($data,...) This function will concatenate all arguments, calculate the SHA-1 digest of this "message", and return it in binary form. The returned string will be 20 bytes long. The result of sha1("a", "b", "c") will be exactly the same as the result of sha1("abc"). sha1_hex($data,...) Same as sha1(), but will return the digest in hexadecimal form. The length of the returned string will be 40 and it will only contain characters from this set: '0'..'9' and 'a'..'f'. sha1_base64($data,...) Same as sha1(), but will return the digest as a base64 encoded string. The length of the returned string will be 27 and it will only contain characters from this set: 'A'..'Z', 'a'..'z', '0'..'9', '+' and '/'. Note that the base64 encoded string returned is not padded to be a multiple of 4 bytes long. If you want interoperability with other base64 encoded sha1 digests you might want to append the redundant string "=" to the result. sha1_transform($data) Implements the basic SHA1 transform on a 64 byte block. The $data argument and the returned $digest are in binary form. This algorithm is used in NIST FIPS 186-2 METHODS
The object oriented interface to "Digest::SHA1" is described in this section. After a "Digest::SHA1" object has been created, you will add data to it and finally ask for the digest in a suitable format. A single object can be used to calculate multiple digests. The following methods are provided: $sha1 = Digest::SHA1->new The constructor returns a new "Digest::SHA1" object which encapsulate the state of the SHA-1 message-digest algorithm. If called as an instance method (i.e. $sha1->new) it will just reset the state the object to the state of a newly created object. No new object is created in this case. $sha1->reset This is just an alias for $sha1->new. $sha1->clone This a copy of the $sha1 object. It is useful when you do not want to destroy the digests state, but need an intermediate value of the digest, e.g. when calculating digests iteratively on a continuous data stream. Example: my $sha1 = Digest::SHA1->new; while (<>) { $sha1->add($_); print "Line $.: ", $sha1->clone->hexdigest, " "; } $sha1->add($data,...) The $data provided as argument are appended to the message we calculate the digest for. The return value is the $sha1 object itself. All these lines will have the same effect on the state of the $sha1 object: $sha1->add("a"); $sha1->add("b"); $sha1->add("c"); $sha1->add("a")->add("b")->add("c"); $sha1->add("a", "b", "c"); $sha1->add("abc"); $sha1->addfile($io_handle) The $io_handle will be read until EOF and its content appended to the message we calculate the digest for. The return value is the $sha1 object itself. The addfile() method will croak() if it fails reading data for some reason. If it croaks it is unpredictable what the state of the $sha1 object will be in. The addfile() method might have been able to read the file partially before it failed. It is probably wise to discard or reset the $sha1 object if this occurs. In most cases you want to make sure that the $io_handle is in "binmode" before you pass it as argument to the addfile() method. $sha1->add_bits($data, $nbits) $sha1->add_bits($bitstring) This implementation of SHA-1 only supports byte oriented input so you might only add bits as multiples of 8. If you need bit level support please consider using the "Digest::SHA" module instead. The add_bits() method is provided here for compatibility with other digest implementations. See Digest for description of the arguments that add_bits() take. $sha1->digest Return the binary digest for the message. The returned string will be 20 bytes long. Note that the "digest" operation is effectively a destructive, read-once operation. Once it has been performed, the "Digest::SHA1" object is automatically "reset" and can be used to calculate another digest value. Call $sha1->clone->digest if you want to calculate the digest without reseting the digest state. $sha1->hexdigest Same as $sha1->digest, but will return the digest in hexadecimal form. The length of the returned string will be 40 and it will only contain characters from this set: '0'..'9' and 'a'..'f'. $sha1->b64digest Same as $sha1->digest, but will return the digest as a base64 encoded string. The length of the returned string will be 27 and it will only contain characters from this set: 'A'..'Z', 'a'..'z', '0'..'9', '+' and '/'. The base64 encoded string returned is not padded to be a multiple of 4 bytes long. If you want interoperability with other base64 encoded SHA-1 digests you might want to append the string "=" to the result. SEE ALSO
Digest, Digest::HMAC_SHA1, Digest::SHA, Digest::MD5 http://www.itl.nist.gov/fipspubs/fip180-1.htm http://en.wikipedia.org/wiki/SHA_hash_functions COPYRIGHT
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Copyright 1999-2004 Gisle Aas. Copyright 1997 Uwe Hollerbach. AUTHORS
Peter C. Gutmann, Uwe Hollerbach <uh@alumni.caltech.edu>, Gisle Aas <gisle@aas.no> perl v5.18.2 2010-07-03 SHA1(3)
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy