Sponsored Content
Top Forums Shell Programming and Scripting How to append database column to a delimited file Post 302368291 by insamniac on Wednesday 4th of November 2009 02:09:29 PM
Old 11-04-2009
assuming your flat file is called file.txt and output file is outfile.txt
Code:
cat file.txt |  sed 's/~/ /g' | while read empNum depName
do
 
empName=$(Your code to get the name from your database using empNum  )
echo "${depName}~${empName}" >> outfile.txt
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing one column of delimited file column to fixed width column

Hi, Iam new to unix. I have one input file . Input file : ID1~Name1~Place1 ID2~Name2~Place2 ID3~Name3~Place3 I need output such that only first column should change to fixed width column of 15 characters of length. Output File: ID1<<12 spaces>>Name1~Place1 ID2<<12... (5 Replies)
Discussion started by: manneni prakash
5 Replies

2. UNIX for Dummies Questions & Answers

add (append) a column in a tab delimited file

I have a file having the following entries: test1 test2 test3 11 22 33 22 44 66 99 99 44 --- I want to add a column so that the above file becomes: test1 test2 test3 notest 11 22 33 * 22 44 66 * 99 99 44 * --- Thanks (6 Replies)
Discussion started by: mary271
6 Replies

3. Shell Programming and Scripting

[Solved] Append an header to a tab delimited file

Dear All, I would like to find an automatic way to add a given code which belong to a class at the end of the column , for example this is my input file: 0610009O20Rik V$VMYB_01 310 (+) 1 0.971 v-Myb V$EVI1_04 782 (-) 0.763 0.834 Evi-1 V$ELK1_02 1966 (-) 1 0.984 Elk-1... (4 Replies)
Discussion started by: paolo.kunder
4 Replies

4. UNIX for Dummies Questions & Answers

Cut the two column from non delimited file

Hi, I have a question how to cut the column from non delimited file This is my file gene_id ENSG00000223972 transcript_id ENST00000456328 exon_number 1 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-002 tss_id TSS26614 gene_id ENSG00000223972 transcript_id ENST00000515242... (1 Reply)
Discussion started by: Wan Fahmi
1 Replies

5. Shell Programming and Scripting

Append data to first column delimited file

Hi, I have a data like Input: 12||34|56|78 Output: XYZ|12||34|56|78 I tried like this , but it puts it on another line awk -F "|" ' BEGIN {"XYZ"} {print $0} 'file Any quick suggessitons in sed/awk ? am using HP-UX (3 Replies)
Discussion started by: selvankj
3 Replies

6. Shell Programming and Scripting

Replacing a column in a pipe delimited file

Hi, I have a pipe delimited file as below and I need to replace the 2nd column of each line with null values. 1|10/15/2011|fname1|lname1 2|10/15/2012|fname2|lname2 3|10/15/2013|fname3|lname3 Output file: 1||fname1|lname1 2||fname2|lname2 3||fname3|lname3 I tried this ... (2 Replies)
Discussion started by: member2014
2 Replies

7. Shell Programming and Scripting

Matching column then append to existing File as new column

Good evening I have the below requirements, as I am not an experts in Linux/Unix and am looking for your ideas how I can do this. I have file called file1 and file2. I need to get the second column which is text1_random_alphabets and find that in file 2, if it's exists then print the 3rd... (4 Replies)
Discussion started by: mychbears
4 Replies

8. Shell Programming and Scripting

Matching column value from 2 different file using awk and append value from different column

Hi, I have 2 csv files. a.csv HUAWEI,20LMG011_DEKET_1296_RTN-980_IDU-1-11-ISV3-1(to LAMONGAN_M),East_Java,20LMG011_DEKET_1296_RTN-980_IDU-1,20LMG011,20LMG 027_1287_LAMONGAN_RTN980_IDU1,20LMG027,1+1(HSB),195.675,20LMG011-20LMG027,99.9995,202.6952012... (7 Replies)
Discussion started by: tententen
7 Replies

9. UNIX for Beginners Questions & Answers

Replace a column in tab delimited file with column in other tab delimited file,based on match

Hello Everyone.. I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files FileP.txt ... (2 Replies)
Discussion started by: YogeshG
2 Replies

10. UNIX for Beginners Questions & Answers

Compare 1st column from 2 file and if match print line from 1st file and append column 7 from 2nd

hi I have 2 file with more than 10 columns for both 1st file apple,0,0,0...... orange,1,2,3..... mango,2,4,5..... 2nd file apple,2,3,4,5,6,7... orange,2,3,4,5,6,8... watermerlon,2,3,4,5,6,abc... mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies
OPENSSL_PKCS7_ENCRYPT(3)						 1						  OPENSSL_PKCS7_ENCRYPT(3)

openssl_pkcs7_encrypt - Encrypt an S/MIME message

SYNOPSIS
bool openssl_pkcs7_encrypt (string $infile, string $outfile, mixed $recipcerts, array $headers, [int $flags], [int $cipherid = OPENSSL_CIPHER_RC2_40]) DESCRIPTION
openssl_pkcs7_encrypt(3) takes the contents of the file named $infile and encrypts them using an RC2 40-bit cipher so that they can only be read by the intended recipients specified by $recipcerts. PARAMETERS
o $infile - o $outfile - o $recipcerts - Either a lone X.509 certificate, or an array of X.509 certificates. o $headers -$headers is an array of headers that will be prepended to the data after it has been encrypted. $headers can be either an asso- ciative array keyed by header name, or an indexed array, where each element contains a single header line. o $flags -$flags can be used to specify options that affect the encoding process - see PKCS7 constants. o $cipherid - One of cipher constants. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 openssl_pkcs7_encrypt(3) example <?php // the message you want to encrypt and send to your secret agent // in the field, known as nighthawk. You have his certificate // in the file nighthawk.pem $data = <<<EOD Nighthawk, Top secret, for your eyes only! The enemy is closing in! Meet me at the cafe at 8.30am to collect your forged passport! HQ EOD; // load key $key = file_get_contents("nighthawk.pem"); // save message to file $fp = fopen("msg.txt", "w"); fwrite($fp, $data); fclose($fp); // encrypt it if (openssl_pkcs7_encrypt("msg.txt", "enc.txt", $key, array("To" => "nighthawk@example.com", // keyed syntax "From: HQ <hq@example.com>", // indexed syntax "Subject" => "Eyes only"))) { // message encrypted - send it! exec(ini_get("sendmail_path") . " < enc.txt"); } ?> PHP Documentation Group OPENSSL_PKCS7_ENCRYPT(3)
All times are GMT -4. The time now is 04:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy