Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Search of multiple numeric entries in an output file Post 303034431 by Xtreme on Thursday 25th of April 2019 02:40:22 PM
Old 04-25-2019
Search of multiple numeric entries in an output file

Hello Tech Guys,

I have two files named check.txt and output.txt

Content of check.txt

Code:
620070527336551	 40201800027285
620070551928314	 40201800027285
620070534376312	 40201800027285
620070536668046	 02711306140261
620070248491123	 02711306140261
620070553851296	 02711306140261
620070446225438	 02711306140261
620070544871702	 02711306140261

Content of output.txt

Code:
# extended LDIF
#
# LDAPv3
# base <data=40201800027285
# filter: (objectclass=*)
# requesting: ALL
#

# 40201800027285
dn: data=40201800027285
data: 40201800027285
objectClass: device2g3g
locked: 000000000000000
locked: 620070527336551
locked: 620070000095731
locked: 620070534376312

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1
# extended LDIF
#
# LDAPv3
# base <data=02711306140261
# filter: (objectclass=*)
# requesting: ALL
#

# 02711306140261
dn: data=02711306140261
data: 02711306140261
objectClass: device2g3g
locked: 620070263383027
locked: 620070551073690
locked: 620070446225438
locked: 620070555544259
locked: 620070453835231
locked: 620070248491123
locked: 620070556469603
locked: 620070536668046

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

The output.txt contains the search of two numeric data numbers i.e. 40201800027285 and 02711306140261 (could be more than two). Against each of these two numeric values the system provided the total number of locked items (could be more). Now I need to compare these locked items alongwith the items present in search.txt in 1st coloum and need to know the difference. The desired output after comparing these two files will be saved in difference.txt and should be like below:

Code:
data: 40201800027285
locked: 620070527336551    620070534376312
unlocked: 620070551928314

data: 02711306140261
locked: 620070536668046    620070248491123    620070446225438
unlocked: 620070553851296    620070544871702

Kindly suggest a code for the above described requirement. Efforts will be really appreciable.

Thanks.

Last edited by vgersh99; 04-25-2019 at 06:36 PM.. Reason: added code tags to the ouput
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bourne: search for a non-numeric character in $VAR

if $1 = "123x456", how can I test for the non-numeric character 'x' in that string. I've tried expr with "" but it did not find the x. Any ideas? Can this perhaps be done with sed? Thanks. (2 Replies)
Discussion started by: lumix
2 Replies

2. UNIX for Dummies Questions & Answers

rename multiple files from search output

Variations of multiple renames seems to come up a lot but i can't find the answer to this situation. Tidying up a directory where people rename files to .working, .bob, .attempt1 & so on. what i am trying to do is: list the file type, & rename from ".whatever" to .fixed. As the ".whatever" is... (5 Replies)
Discussion started by: woodstock
5 Replies

3. UNIX for Dummies Questions & Answers

SED command to search for numeric and replace

Hi I am very new to linux and scripting. I need to replace numbers abc with number xyz inputting from a reference file. I used the following command - sed "s/$grd/$lab/" , where $grd and $lab comes from reference file. The problem is the above line doesnt take care of space..... (1 Reply)
Discussion started by: ajayh
1 Replies

4. Shell Programming and Scripting

Check for Numeric output in Perl

Hi All, I would like to convert my below csh script to Perl. Can any expert help ? # To check for numeric input set tested1 = `echo "$tested"| awk '/^+$/'`; # To remove un-neccessary zeros set tested2 = `echo "$tested"|awk '{print $0+0}'`; (3 Replies)
Discussion started by: Raynon
3 Replies

5. Shell Programming and Scripting

AWK: Discrepancy in numeric output

During a file-system cleanup I noticed a strange behavior of awk (HP-UX 11iv3 / IA64). When summing up the size of files in one directory it gives different numbers when using print as opposed to printf: find . -type f -name '*.dmp.Z' -mtime +35 -exec ls -l {} \+ | \ awk 'BEGIN{ OFMT="%f" } {... (1 Reply)
Discussion started by: pludi
1 Replies

6. Shell Programming and Scripting

Storing or Using Numeric Output From a Function

Hi all, I'm trying to implement a linear congruential pseudorandom number generator (<http://en.wikipedia.org/wiki/Linear_congruential_generator>), since $RANDOM and /dev/random aren't standardized. I'm referring to the Shell & Utilities volume of POSIX.1-2008, but I'm running into some odd... (3 Replies)
Discussion started by: PehJota
3 Replies

7. Shell Programming and Scripting

Using a single "find" cmd to search for multiple file types and output individual files

Hi All, I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd. What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies

8. Shell Programming and Scripting

Grep from multiple patterns multiple file multiple output

Hi, I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command. Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns. Xargs -I {} grep... (3 Replies)
Discussion started by: Diya123
3 Replies

9. UNIX for Dummies Questions & Answers

Search file and print everything except multiple search terms

I'm trying to find a way to search a range of similar words in a file. I tried using sed but can't get it right:sed 's/\(ca01\)*//'It only removes "ca01" but leaves the rest of the word. I still want the rest of the information on the lines just not these specific words listed below. Any... (3 Replies)
Discussion started by: seekryts15
3 Replies

10. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies
X2SYS_MERGE(1gmt)					       Generic Mapping Tools						 X2SYS_MERGE(1gmt)

NAME
x2sys_merge - Merge an updated COEs tables SYNOPSIS
x2sys_merge -Amain_COElist.d -Mnew_COElist.d DESCRIPTION
x2sys_merge will read two crossovers data base and output the contents of the main one updated with the COEs in the second one. The second file should only contain updated COEs relatively to the first one. That is, it MUST NOT contain any new two tracks intersections (This point is NOT checked in the code). This program is useful when, for any good reason like file editing NAV correction or whatever, one had to recompute only the COEs between the edited files and the rest of the database. -A Specify the file main_COElist.d with the main crossover error data base. -M Specify the file new_COElist.d with the newly computed crossover error data base. OPTIONS
No space between the option flag and the associated arguments. EXAMPLES To update the main COE_data.txt with the new COEs estimations saved in the smaller COE_fresh.txt, try x2sys_merge -ACOE_data.txt -MCOE_fresh.txt > COE_updated.txt SEE ALSO
x2sys_binlist(1), x2sys_cross(1), x2sys_datalist(1), x2sys_get(1), x2sys_init(1), x2sys_list(1), x2sys_put(1), x2sys_report(1) GMT 4.5.7 15 Jul 2011 X2SYS_MERGE(1gmt)
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy