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
XCLIP-COPYFILE(1)					      General Commands Manual						 XCLIP-COPYFILE(1)

NAME
xclip-copyfile, xclip-cutfile, xclip-pastefile - copy and move files via the X clipboard SYNOPSIS
xclip-copyfile [-p] FILES... xclip-cutfile [-p] FILES... xclip-pastefile DESCRIPTION
xclip-copyfile copies files into the X clipboard, recursing into directories. xclip-cutfile copies the files, but also deletes them afterwards. -p preserve path formation xclip-pastefile pastes the files out of the clipboard EXAMPLES
Copying a file to a remote host [maggie.lkpg.cendio.se ~]$ echo "A file created on ${HOSTNAME}" > file1 [maggie.lkpg.cendio.se ~]$ xclip-copyfile file1 [sofie.homeip.net ~/doc]$ xclip-pastefile file1 [sofie.homeip.net ~/doc]$ cat file1 A file created on maggie.lkpg.cendio.se Copying an entire tree structure [sofie.homeip.net ~]$ xclip-copyfile doc [maggie.lkpg.cendio.se ~/tmp]$ xclip-pastefile doc/ doc/letter-mom-april.txt doc/file1 doc/letter-dad-march.txt Copying files with preserved path information [maggie.lkpg.cendio.se ~]$ xclip-copyfile -p /etc/sysconfig/grub tar: Removing leading `/' from member names [sofie.homeip.net ~/tmp]$ xclip-pastefile etc/sysconfig/grub [sofie.homeip.net ~/tmp]$ ls etc/sysconfig/grub etc/sysconfig/grub Moving files [sofie.homeip.net ~]$ ls letter-brother-may.txt letter-brother-may.txt [sofie.homeip.net ~]$ xclip-cutfile letter-brother-may.txt [sofie.homeip.net ~]$ ls letter-brother-may.txt ls: cannot access letter-brother-may.txt: No such file or directory [sofie.homeip.net ~]$ cd doc [sofie.homeip.net ~/doc]$ xclip-pastefile letter-brother-may.txt AUTHORS
This manual page was written by Maximilian Gass <mxey@cloudconnected.org> for the Debian project. It may be used for everything else, of course. XCLIP-COPYFILE(1)
All times are GMT -4. The time now is 07:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy