Sponsored Content
Top Forums Shell Programming and Scripting Find string in one file and manipulate other Post 302672095 by pparthiv on Monday 16th of July 2012 12:01:43 AM
Old 07-16-2012
Find string in one file and manipulate other

hi,

I have 2 files delimited by "|"

File 1:
HTML Code:
1|28|ABC|11|9620034||XXX555|
29|22|ABC|11|9620258||XXX555|
51|26|ABC|11|9620314||XXX555|
77|20|ABC|11|9630506||XXX555|
97|36|ABC|11|9630562||XXX555|
File 2:
HTML Code:
9620028|I
9620034|I
9620314|S
9620332|I
9620258|I
9630506|S
9630562|S
9631795|I
9640217|S
9640232|I
Now, For each 1st field in File 2
if found in field 5 of file 1,
place the 2nd field of File 2 into last field of File 1 to look like:

Result:
HTML Code:
1|28|ABC|11|9620034||XXX555|I|
29|22|ABC|11|9620258||XXX555|I|
51|26|ABC|11|9620314||XXX555|I|
77|20|ABC|11|9630506||XXX555|S|
97|36|ABC|11|9630562||XXX555|S|
How can I do this ? Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed command to find, manipulate and replace a number

Hi, Im very new to the world of sed so I'm really not even sure if this is possible. What i need to do is read from a flat file and every time i see this line: VAL=123,456 I need to change 456 to 457 for every occurence of this line in the file. The numbers 123 and 456 are different for... (6 Replies)
Discussion started by: LT_2008
6 Replies

2. Shell Programming and Scripting

Manipulate string in shell script

I am writing a shell script for some purpose. I have a variable of the form -- var1 = "policy=set policy" Now I need to manipulate the variable var to get the string after index =. that is i should have "set polcy". Also I need to to this for many other variables where the value of "=" is not... (3 Replies)
Discussion started by: Dev_Sharma987
3 Replies

3. Linux

Find String in FileName and move the String to new File if not found

Hi all, I have a question.. Here is my requirement..I have 500 files in a path say /a/b/c I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies

4. Shell Programming and Scripting

Find multiple string in one file using find command

Hi, I want find multiple string in one file using find coomand. And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies

5. Shell Programming and Scripting

find string and replace with string in other file

Dear all, I need your help, I have file like this: file1:23456 01910964830098775635 34567 01942809546554654323 67589 26546854368698023653 09778 58716868568576876878 08675 86178546154065406546 08573 54165843543054354305 . .file2: 23456 25 34567 26 67589 27 (2 Replies)
Discussion started by: attila
2 Replies

6. Shell Programming and Scripting

Manipulate XML File Continous STRING by each Order Line using SHELL

heres sample File: <?xml version="1.0"?> <!DOCTYPE cXML SYSTEM "www"><cXML.............................................. <OrderRequest>USE UNIX.com</Extrinsic><Extrinsic name="UniqueName">Peter@UNIX.com</Extrinsic><Extrinsic name="ContractingEntity">UNIX... (3 Replies)
Discussion started by: Pete.kriya
3 Replies

7. Shell Programming and Scripting

Find string in file and append new string after

Hi All, I'm trying to insert a string into a file at a specific location. I'd like to add a string after the parent::__construct(); in my file. <?php if (! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Controller extends CI_Controller { function... (6 Replies)
Discussion started by: jjkilpatrick
6 Replies

8. Shell Programming and Scripting

Find string in file and find the all records by string

Hello I would like to get know how to do this: I got a big file (about 1GB) and I need to find a string (for instance by grep ) and then find all records in this file based on a string. Thanks for advice. Martin (12 Replies)
Discussion started by: mape
12 Replies

9. UNIX for Advanced & Expert Users

Manipulate files with find and fuser not working as expected on SunOs

Greetings, For housekeeping, I use the following command: find /some/path -type f -name "*log*" ! -exec fuser -s "{}" 2>/dev/null \; -exec ls -lh {} \; It finds all log files not currently in use by a process and manipulates them. This command always works on linux and redhat machines,... (2 Replies)
Discussion started by: dampio
2 Replies

10. Shell Programming and Scripting

How to manipulate string in line?

Hello, I looked up on google but do not know from which point to start... I am under ubuntu 18 bionic and Mainfile consists of 25K lines MainFile: Test,AAEE9FED3, GGBBDD DD AA X2d Moscow 112233445566aaBBccPPdddEE Test,AAEE9FED3, GG33DD s00022 Leningrad 11298932566aaBBccPPdddEE... (8 Replies)
Discussion started by: baris35
8 Replies
VOS_LISTADDRS(1)					       AFS Command Reference						  VOS_LISTADDRS(1)

NAME
vos_listaddrs - Displays all VLDB server entries SYNOPSIS
vos listaddrs [-uuid <uuid of server>] [-host <address of host>] [-printuuid] [-cell <cell name>] [-noauth] [-localauth] [-verbose] [-encrypt] [-noresolve] [-help] vos lista [-u <uuid of server>] >>> [-h <address of host>] [-p] [-c <cell name>] [-noa] [-l] [-v] [-e] [-nor] [-he] DESCRIPTION
The vos listaddrs command displays all of the server entries from the Volume Location Database (VLDB). An entry is created as the File Server initializes and registers the contents of its /var/lib/openafs/local/sysid file in the VLDB. OPTIONS
-host <address of host> Rather than displaying all the server entries, display only server entries for the specified host. This will show all multihomed addresses registered by that File Server in the VLDB. -uuid <uuid of server> Rather than displaying all the server entries, display only server entries for the File Server with the specified UUID. This will show all multihomed addresses registered by that File Server in the VLDB and also allows mapping a File Server UUID to its address. -printuuid Prints the UUID of server entries in addition to the registered addresses. The -printuuid option is available in OpenAFS versions 1.4.5 or later and 1.5.8 or later. -cell <cell name> Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see vos(1). -noauth Assigns the unprivileged identity anonymous to the issuer. Do not combine this flag with the -localauth flag. For more details, see vos(1). -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The vos command interpreter presents it to the Volume Server and Volume Location Server during mutual authentication. Do not combine this flag with the -cell argument or -noauth flag. For more details, see vos(1). -verbose Produces on the standard output stream a detailed trace of the command's execution. If this argument is omitted, only warnings and error messages appear. -encrypt Encrypts the command so that the operation's results are not transmitted across the network in clear text. This option is available in OpenAFS versions 1.4.11 or later and 1.5.60 or later. -noresolve Shows all servers as IP addresses instead of the DNS name. This is very useful when the server address is registered as 127.0.0.1 or when dealing with multi-homed servers. This option is available in OpenAFS versions 1.4.8 or later and 1.5.35 or later. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output displays all server entries from the VLDB, each on its own line. If a file server machine is multihomed, all of its registered addresses appear on the line. The first one is the one reported as a volume's site in the output from the vos examine and vos listvldb commands. The VLDB records IP addresses, and the command interpreter has the local name service (either a process like the Domain Name Service or a local host table) translate them to hostnames before displaying them. If an IP address appears in the output, it is not possible to translate it. The existence of an entry does not necessarily indicate that the machine that is still an active file server machine. To remove obsolete server entries, use the vos changeaddr command with the -remove argument. EXAMPLES
The following command displays the VLDB server entries in the ABC Corporation cell: % vos listaddrs sv5.abc.com sv1.abc.com sv2.abc.com afs2.abc.com sv6.abc.com The following command displays the VLDB server entry and UUID for host sv5.abc.com in the ABC Corporation cell: % vos listaddrs -p -ho sv5.abc.com UUID: 000c5aff-8246-1699-96-c4-437b5a45aa77 sv5.abc.com PRIVILEGE REQUIRED
None SEE ALSO
fs_uuid(1), sysid(5), vos(1), vos_changeaddr(1), vos_examine(1), vos_listvldb(1) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 VOS_LISTADDRS(1)
All times are GMT -4. The time now is 11:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy