Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Map a string in a the middle of a record Post 302901696 by itkamaraj on Thursday 15th of May 2014 05:21:57 AM
Old 05-15-2014
Code:
$> cat /tmp/a.txt
123456789           bbbb      234545
123454567           cccc      23452
1234567890sas       dddd      1234
124345677           bbbb      123445

$> cat /tmp/b.txt
aaaa
bbbb
cccc

$> fgrep -w -f /tmp/b.txt /tmp/a.txt
123456789           bbbb      234545
123454567           cccc      23452
124345677           bbbb      123445

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem to add the string(without sed & awk) into the middle of file

Hi, I have tried many times to add the string into the first line of the file or the middle of the file but could not find the solution. I first tried by $echo "paki" >> file This code only append paki string at the end of file "file" but how can i add this "paki" into the first line or... (5 Replies)
Discussion started by: ali hussain
5 Replies

2. Shell Programming and Scripting

add a string in the middle of the file

i want to add a string in a very top of a file without using VI or SED or AWK this is what ive done: (echo '0a'; echo 'LINE OF TEXT'; echo '.'; echo 'wq') | ed -s myfile to add astrng right in the middle i could have count the lines of the file and just chenge the address. ... (6 Replies)
Discussion started by: ciroredz
6 Replies

3. Shell Programming and Scripting

stripping certain characters in at the middle of a string

I am trying to strip out certain characters from a string on both (left & right) sides. For example, line=see@hear|touch, i only want to echo the "hear" part. Well i have tried this approach: line=see@hear|touch templine=${line#*@} #removed "see@" echo ${templine%%\|*} #removed... (4 Replies)
Discussion started by: mcoblefias
4 Replies

4. UNIX for Dummies Questions & Answers

Add string to middle of a file

Hi, I want to write a script that takes a file and a string as params and adds the string to the middle line of the file. Also, I want to output the results back to the original file passed without using temp files. I am very much new to UNIX so this is all a little like black magic to me at... (15 Replies)
Discussion started by: Chiefos
15 Replies

5. UNIX for Dummies Questions & Answers

Splitting a string and putting another string in the middle?

Hello all! I'm trying to put together a small script that will take in a file name and attach a datestamp to the end of it (but before the file type extension). To illustrate... Before: filename.txt anotherfilename.txt After: filename_20090724.txt anotherfilename_20090724.txt ... (7 Replies)
Discussion started by: jisoo411
7 Replies

6. Shell Programming and Scripting

Find the middle character from a string using sed

Input: qwertmyuiop It should print "m". What's the command to do this with sed? (6 Replies)
Discussion started by: cola
6 Replies

7. Shell Programming and Scripting

mappin strings of two different file and finding the mapped string and then map other fields.

As i am new to unix so facing some problems in scripting: here is my question: i m having two files. 1st file say a.txt contain 3 column like SPECIALITY|UMP_CODE|SPECIALTY_CODE Addictive Diseases|25ADD|ADD Addictive Diseases/Family Practice|25ADD|ADD/FP Aerospace Medicine|1.041666667|AM... (4 Replies)
Discussion started by: dsh007
4 Replies

8. Shell Programming and Scripting

Split string into map (Associative Array)

Hi Input: { committed = 782958592; init = 805306368; max = 1051394048; used = 63456712; } Result: A map (maybe Associative Array) where I can iterate through the key/value. Something like this: for key in $map do echo key=$key value=$map done Sample output from the map: ... (2 Replies)
Discussion started by: chitech
2 Replies

9. Linux

Remove newline in middle of string

my file input is with tab as delimiter, and in every line, there would be a skip of line with an unexcepted newline breaker. I'd like to remove this \n and put the information in the same line. INPUT a1 b1b2 c1 c2 d1 a2 b3 c3 d4 OUTPUT a1 b1b2 c1c2 ... (9 Replies)
Discussion started by: kinkichin
9 Replies

10. Shell Programming and Scripting

Replace a string for every record after the 1st record

I have data coming in the below format for each record <?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><testdetials>....</test_sox> <?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox... (8 Replies)
Discussion started by: dsravanam
8 Replies
kerberosautoconfig(8)					    BSD System Manager's Manual 				     kerberosautoconfig(8)

NAME
kerberosautoconfig -- Kerberos -- Open Directory Single Sign On SYNOPSIS
kerberosautoconfig [-f directory_node] [-o output_dir] [-r realm_name -m master_kdc] [-u] [-k] [-v debug_level] DESCRIPTION
The kerberosautoconfig command creates / updates & removes the edu.mit.Kerberos file and the Kerberos:<REALM_NAME> config record in dslocal db from information stored in the Open Directory config record named KerberosClient. The existing edu.mit.Kerberos file is only replaced if the autogenerated header is present and the generation_id in the KerberosClient config record is greater than that within the file. The default location of the output file is /Library/Preferences/edu.mit.Kerberos. If the machine is standalone, this command will do nothing (unless the -u option is used). Definitions: directory_node An open directory node path specifier. Such as /LDAPv3/127.0.0.1 output_dir The directory in which kerberosautoconfig deposits the edu.mit.Kerberos file realm_name Name of the Kerberos realm that will be the default when creating a file from scratch master_kdc Host name of the master KDC for the default realm when creating a file from scratch debug_level Specifies the amount of debugging information printed to stdout, default is 1 Flags: -f Tells kerberosautoconfig to look in the specified open directory node for the KerberosClient config record. -o Specifies the directory in which kerberosautoconfig will write the new edu.mit.Kerberos file into -r kerberosautoconfig can create an edu.mit.Kerberos file from information passed on the command line. Use the -r and -m flags to spec- ify the default realm and master KDC for that realm. -m See above -k Adds the default Kerberos logging directives to the config file (useful when setting up a kdc) -u Forces an update of the file. Will overwrite an existing non-autogenerated edu.mit.Kerberos file. Use with caution. -v Specifies the amount of debugging information printed to stdout, default is 1 FILES
/Library/Preferences/edu.mit.Kerberos The main Kerberos config file (also known as krb5.conf on other systems) SEE ALSO
DirectoryService(1), Kerberos(1), kdcsetup(8), krb5.conf(5) BUGS
kerberosautoconfig looks for the KerberosClient config record in each of the open directory nodes on the search path. It merges the realm information from any KerberosClient config records it finds, but it only checks the generation_id from the first config record found. This means that the file does not get updated if the second KerberosClient record found changes. HISTORY
kerberosautoconfig first appeared in Mac OS X 10.3 Darwin June 2, 2019 Darwin
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy