Sponsored Content
Top Forums Shell Programming and Scripting Find keywords, and append at the end of line Post 302898546 by vgersh99 on Tuesday 22nd of April 2014 03:01:42 PM
Old 04-22-2014
just a guess, pal!
Code:
awk -F'|' 'FNR==NR{keys[$0];next} {for(i in keys) {if ($1==i) $0=$0 OFS i; if ($2==i) $0=$0 ((NF>2)? " ":OFS) i}}1' OFS='|' keywords.txt outfile.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to append words at the end of first line

Hi Unix gurus This is my first post here. I have a file which looks like this: string1,string2 ,string3 ,string4 ... ... I need to append all words below first line to the first line, ie string1,string2,string3,string4,... Bear in mind that it is not known how many lines follow... (11 Replies)
Discussion started by: lmatlebyane
11 Replies

2. Shell Programming and Scripting

how to append the pattern at the end of the line

-Hi I have multiple files which contain a line with the word "exec". I need to add the following pattern " -cmode -ccheap" on the same line where "exec" is at the end. Any idea? Thanks a lot in advance to everybody... -A (2 Replies)
Discussion started by: aoussenko
2 Replies

3. Shell Programming and Scripting

search directory-find files-append at end of line

Hi, I have a command "get_data" with some parameters in few *.text files of a directory. I want to first find those files that contain this command and then append the following parameter to the end of the command. example of an entry in the file :- get_data -x -m50 /etc/web/getid this... (1 Reply)
Discussion started by: PrasannaKS
1 Replies

4. Shell Programming and Scripting

append end of line with 8 spaces

child_amt=$amount prev_line="$prev_line $child_amt" i am getting the result like this 21234567890001343 000001004OLFXXX029100020091112 0000060 but i want 8 spaces between the eg: 21234567890001343 000001004OLFXXX029100020091112 0000060 how can i do this in .ksh (1 Reply)
Discussion started by: kshuser
1 Replies

5. UNIX for Dummies Questions & Answers

Append characters to end of line

Coding in unix shell script. Hi All, Please help Thanks (6 Replies)
Discussion started by: sam12345
6 Replies

6. Shell Programming and Scripting

Append text to end of every line

I've scoured the internet with mixed results. As an amateur I turn to the great minds here. I have a text file of 80 or so lines. I want to add ".pdf" to the end of each line. (For now that's it) Most of the internet points toward using "sed". I don't know coding but can figure things out... (4 Replies)
Discussion started by: spacebase
4 Replies

7. Shell Programming and Scripting

find a certain line and append text to the end of the line

After I create printer queues in AIX, I have to append a filter file location within that printers custom file. within lets say test_queue.txt I need to find the row that starts with :699 and then I need to append on the end the string /usr/local/bin/k_portrait.sh. Now I've gotten the sed... (2 Replies)
Discussion started by: peachclift
2 Replies

8. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

9. Shell Programming and Scripting

Append this string to end of each line

Platform: Solaris 10 I have a file like below $ cat languages.txt Spanish Norwegian English Persian German Portugese Chinese Korean Hindi Malayalam Bengali Italian Greek Arabic I want to append the string " is a great language" at end of each line in this file. (3 Replies)
Discussion started by: omega3
3 Replies

10. Shell Programming and Scripting

Append Pipes at the end of each line

Hi , I have pipe delimited file containing 12 columns having below data in AIX Input : A|B|C|D|E|F|G|H|I|J|K|L^M A1|B1|C1|D1|E1^M A2|B2|C2^M So in first row i have 11 pipes which is fine. In second row I have 4 pipes, so additional 7 pipes should get append In third row I have 2... (3 Replies)
Discussion started by: sonu_pal
3 Replies
EBook::Tools::MSReader(3pm)				User Contributed Perl Documentation			       EBook::Tools::MSReader(3pm)

NAME
EBook::Tools::MSReader - Helper code for working with Microsoft Reader (.lit) e-books. SYNOPSIS
use EBook::Tools::MSReader qw(find_convertlit find_convertlit_keys system_convertlit); $EBook::Tools::MSReader::convertlit_cmd = '/opt/convertlit/clit'; $EBook::Tools::MSReader::convertlit_keys = '/opt/convertlit/keys.txt'; my $convertlit = find_convertlit(); my $keyfile = find_convertlit_keys(); system_convertlit(infile => 'myfile.lit', dir => 'myfile-unpacked'); PROCEDURES
All procedures are exportable, but none are exported by default. "find_convertlit()" Attempts to locate the convertlit executable by making a test execution on predicted locations (including just checking PATH) and looking in the EBook::Tools user configuration directory (see "userconfigdir()" in EBook::Tools. Returns the system command used for a successful invocation, or undef if nothing worked. This will use package variable $convertlit_cmd as its first guess, and set that variable to the return value as well. "find_convertlit_keys($filename)" Attempts to locate the convertlit "keys.txt" file by checking predicted filenames, both in the current working directory and in the EBook::Tools user configuration directory (see "userconfigdir()" in EBook::Tools. If $filename is provided, the file "basename-keys.txt" will also be checked in both locations. Returns the name of the first file found, or undef if nothing was found. This will use package variable $convertlit_keys as its first guess, and set that variable to the return value as well. "system_convertlit(%args)" Runs "convertlit" to extract or downconvert a MS Reader .lit file. The procedures find_convertlit() and find_convertlit_keys() are both called to locate necessary helper files. Returns the return value from convertlit, or undef if convertlit or the input file could not be found, or neither output file nor directory is specified. Arguments o "infile" The input filename. If not specified or invalid, the procedure croaks. o "outfile" The output filename. If this is specified convertlit will perform a downconversion. o "dir" The output directory. If this is specified, and "outfile" is not, convertlit will perform an extraction. If both this and "outfile" are specified, convertlit will downconvert and place the downconverted file into the specified directory. o "keyfile" The location of the "keys.txt" file containing the encryption keys, if available. This is only required if the ".lit" file is DRM- protected and package variable $convertlit_keys does not point to the correct file. BUGS AND LIMITATIONS
o All handling happens through ConvertLIT as an external helper. Native Perl code may eventually be written to handle non-DRMed extraction. o Unit tests are unwritten AUTHOR
Zed Pobre <zed@debian.org> LICENSE AND COPYRIGHT
Copyright 2008 Zed Pobre Licensed to the public under the terms of the GNU GPL, version 2. ConvertLIT (not included) is copyright 2002, 2003 Dan A. Jackson, and licensed under the terms of the GNU GPL, version 2 or later. perl v5.10.1 2012-01-05 EBook::Tools::MSReader(3pm)
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy