Sponsored Content
Top Forums Shell Programming and Scripting create txt file form data file Post 302721803 by Yoda on Thursday 25th of October 2012 08:22:21 PM
Old 10-25-2012
Code:
for key in `awk ' { print $1 } ' A.txt | sort | uniq`
do
        echo "Hello\nprl" > ${key}.txt
        awk '/'$key'/ { print "Fi Na=" $2 " no=" $3 } ' A.txt >> ${key}.txt
        echo "bye\nq" >> ${key}.txt
done

Note: please use -e option for echo if you are using bash.
This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix script to takes the old data from a TXT file and compress them into new file

Hi, I am looking for the unix script which can takes the 2 month old data from a TXT file (there is one txt file in whiche messages are appended on daily basis) and compress them into new file.Please halp me out. (2 Replies)
Discussion started by: vpandey
2 Replies

2. UNIX for Dummies Questions & Answers

create file .txt

hi.i want to create a bash script called countfiles.sh, that will count the pack of files under the current file that their term satisfy a specific pattern. The script must show the total per file or on the whole. thank tou (4 Replies)
Discussion started by: battaglia
4 Replies

3. Shell Programming and Scripting

how to create file.txt and add current date in file content

Hey guy, how to make bash script to create foo.txt file and add current date into file content and that file always append. example: today the script run and add today date into content foo.txt and tomorrow the script will run and add tomorrow date in content foo.txt without remove today... (3 Replies)
Discussion started by: chenboly
3 Replies

4. Shell Programming and Scripting

Select some lines from a txt file and create a new file with awk

Hi there, I have a text file with several colums separated by "|;#" I need to search the file extracting all columns starting with the value of "1" or "2" saving in a separate file just the first 7 columns of each row maching the criteria, with replacement of the saparators in the nearly created... (4 Replies)
Discussion started by: capnino
4 Replies

5. Programming

help need in the perl script that create one xml file form multiple files.

Hi every one, Please excuse me if any grammatical mistakes is there. I have multiple xml files in one directory, I need to create multiple XML files into one XML file.example files like this</p> file1:bvr.xml ... (0 Replies)
Discussion started by: veerubiji
0 Replies

6. Shell Programming and Scripting

Want to read data from a file name.txt and search it in another file and then matching...

Hi Frnds... I have an input file name.txt and another file named as source.. name.txt is having only one column and source is having around 25 columns...i need to read from name.txt line by line and search it in source file and then save the result in results file.. I have a rough idea about the... (15 Replies)
Discussion started by: ektubbe
15 Replies

7. Shell Programming and Scripting

Copy data form File A and Create File B

File A I have list of : ABCND1 ABCND2 ABCnd3 ABCnd4 I want file B like below Start+ S Pate=ABCND1 AAlo1 S Pate=ABCND1 Q1234 S Pate=ABCND1,P12345 (7 Replies)
Discussion started by: asavaliya
7 Replies

8. Shell Programming and Scripting

Get Data From CSV File and put into a txt file

Hi Guys, File A I have File A as CSV Format.... No R SS MK Par value S AL A1 PKL123 Lo12 1 S AL A2 PKl123 Lo34 22 S AL A3 PkLK234 Lo67 -34 S AL A4 PkLK235 Lo09 120 S AL A5 PkLK236 Lo76 19 S AL A6 PkLK237 Lo44 -17 S AL A7 PkLK238 Lo90 2 S AL A8 PkLK239 Lo34 -9 I want file B like... (4 Replies)
Discussion started by: asavaliya
4 Replies

9. 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

10. UNIX for Beginners Questions & Answers

Copy the content from txt file and create a html file

I have a txt file with a list of error messages in a xml tag format, and each error message is separated with a identifier(endresult).Need to split that and copy and create a new html file.Error message has some special character. how to escape the special character and insert my data into the... (7 Replies)
Discussion started by: DevAakash
7 Replies
ENCRYPT(3)						     Linux Programmer's Manual							ENCRYPT(3)

NAME
encrypt, setkey, encrypt_r, setkey_r - encrypt 64-bit messages SYNOPSIS
#define _XOPEN_SOURCE #include <unistd.h> void encrypt(char block[64], int edflag); #define _XOPEN_SOURCE #include <stdlib.h> void setkey(const char *key); #define _GNU_SOURCE #include <crypt.h> void setkey_r(const char *key, struct crypt_data *data); void encrypt_r(char *block, int edflag, struct crypt_data *data); Each of these requires linking with -lcrypt. DESCRIPTION
These functions encrypt and decrypt 64-bit messages. The setkey() function sets the key used by encrypt(). The key argument used here is an array of 64 bytes, each of which has numerical value 1 or 0. The bytes key[n] where n=8*i-1 are ignored, so that the effective key length is 56 bits. The encrypt() function modifies the passed buffer, encoding if edflag is 0, and decoding if 1 is being passed. Like the key argument, also block is a bit vector representation of the actual value that is encoded. The result is returned in that same vector. These two functions are not reentrant, that is, the key data is kept in static storage. The functions setkey_r() and encrypt_r() are the reentrant versions. They use the following structure to hold the key data: struct crypt_data { char keysched[16 * 8]; char sb0[32768]; char sb1[32768]; char sb2[32768]; char sb3[32768]; char crypt_3_buf[14]; char current_salt[2]; long int current_saltbits; int direction; int initialized; }; Before calling setkey_r() set data->initialized to zero. RETURN VALUE
These functions do not return any value. ERRORS
Set errno to zero before calling the above functions. On success, it is unchanged. ENOSYS The function is not provided. (For example because of former USA export restrictions.) CONFORMING TO
The functions encrypt() and setkey() conform to SVr4, SUSv2, and POSIX.1-2001. The functions encrypt_r() and setkey_r() are GNU exten- sions. NOTES
In glibc 2.2 these functions use the DES algorithm. EXAMPLE
You need to link with libcrypt to compile this example with glibc. To do useful work the key[] and txt[] arrays must be filled with a use- ful bit pattern. #define _XOPEN_SOURCE #include <unistd.h> #include <stdlib.h> int main(void) { char key[64]; /* bit pattern for key */ char txt[64]; /* bit pattern for messages */ setkey(key); encrypt(txt, 0); /* encode */ encrypt(txt, 1); /* decode */ } SEE ALSO
cbc_crypt(3), crypt(3), ecb_crypt(3), feature_test_macros(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2003-04-04 ENCRYPT(3)
All times are GMT -4. The time now is 05:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy