Sponsored Content
Top Forums Shell Programming and Scripting Efficient way to search array in text file by awk Post 302958629 by MadeInGermany on Saturday 24th of October 2015 08:58:27 AM
Old 10-24-2015
Do computations with a static result before the loop,
that might save a few CPU cycles.
Code:
len1=length($1)
lenL1=length(L1="91"$1)
for ( mdn in SPLNOMAXLEN)
        {
         if ( ($1 ~ "^"mdn && len1 <=SPLNOMAXLEN[mdn]) || (L1 ~ "^"mdn && lenL1 <=SPLNOMAXLEN[mdn]) )

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

text file search and replace with awk

hello all greeting for the day i have a text file as the following text.xml abcd<FIELD>123.456</FIELD>efgh i need to replace the value between <FIELD> and </FIELD> by using awk command. please throw some light on this. thank you very very much Erik (5 Replies)
Discussion started by: erikshek
5 Replies

2. Shell Programming and Scripting

search needed part in text file (awk?)

Hello! I have text file: From aaa@bbb Fri Jun 1 10:04:29 2010 --____OSPHWOJQGRPHNTTXKYGR____ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline My code '234565'. ... (2 Replies)
Discussion started by: candyme
2 Replies

3. Shell Programming and Scripting

search text file in file if this file contains necessary text (awk,grep)

Hello friends! Help me pls to write correct awk and grep statements for my task: I have got files with name filename.txt It has such structure: Start of file FROM: address@domen.com (12...890) abc DATE: 11/23/2009 on Std SUBJECT: any subject End of file So, I must check, if this file... (4 Replies)
Discussion started by: candyme
4 Replies

4. Shell Programming and Scripting

Better and efficient way to reverse search a file for first matched line number.

How to reverse search for a matched string in a file. Get line# of the first matched line. I am getting '2' into 'lineNum' variable. But it feels like I am using too many commands. Is there a better more efficiant way to do this on Unix? abc.log aaaaaaaaaaaaa bbbbbbbbbbbbb... (11 Replies)
Discussion started by: kchinnam
11 Replies

5. Shell Programming and Scripting

Need an efficient way to search for a tag in an xml file having millions of rows

Hi, I have an XML file with around 1 billion rows in it and i am trying to find the number of times a particular tag occurs in it. The solution i am using works but takes a lot of time (~1 hr) .Please help me with an efficient way to do this. Lets say the input file is <Root> ... (13 Replies)
Discussion started by: Sheel
13 Replies

6. Homework & Coursework Questions

Efficient Text File Writing

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a template main.c file via shell script to make it easier for yourself later. The issue here isn't writing... (2 Replies)
Discussion started by: george3isme
2 Replies

7. Shell Programming and Scripting

Efficient population of array from text file

Hi, I am trying to populate an array with data from a text file. I have a working method using awk but it is too slow and inefficent. See below. The text file has 70,000 lines. As awk is a line editor it reads each line of the file until it gets to the required line and then processes it.... (3 Replies)
Discussion started by: carlr
3 Replies

8. Shell Programming and Scripting

Search and replace from file in awk using a 16 bit text file

Hello, Some time ago a helpful awk file was provided on the forum which I give below: NR==FNR{A=$0;next}{for(j in A){split(A,P,"=");for(i=1;i<=NF;i++){if($i==P){$i=P}}}}1 While it works beautifully on English and Latin characters i.e. within the ASCII range of 127, the moment a character beyond... (6 Replies)
Discussion started by: gimley
6 Replies

9. Shell Programming and Scripting

Search text beween tags and write to file using awk

Hi Friends, I have a very big text file, that has code for multiple functions. I have scan through the file and write each function in seperate file. All functions starts with BEGIN DSFNC Identifier "ABCDDataValidationfnc" and ends with END DSFNC I need create a file(using identifier)... (2 Replies)
Discussion started by: anandapani
2 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
Cpuset Helpers(3)					     Hardware Locality (hwloc)						 Cpuset Helpers(3)

NAME
Cpuset Helpers - Functions static inline hwloc_const_cpuset_t hwloc_topology_get_complete_cpuset (hwloc_topology_t topology) " static inline hwloc_const_cpuset_t hwloc_topology_get_topology_cpuset (hwloc_topology_t topology) " static inline hwloc_const_cpuset_t hwloc_topology_get_online_cpuset (hwloc_topology_t topology) " static inline hwloc_const_cpuset_t hwloc_topology_get_allowed_cpuset (hwloc_topology_t topology) " Detailed Description Function Documentation static inline hwloc_const_cpuset_t hwloc_topology_get_allowed_cpuset (hwloc_topology_ttopology) [static] Get allowed CPU set. Returns: the CPU set of allowed logical processors of the system. If the topology is the result of a combination of several systems, NULL is returned. Note: The returned cpuset is not newly allocated and should thus not be changed or freed, hwloc_cpuset_dup must be used to obtain a local copy. static inline hwloc_const_cpuset_t hwloc_topology_get_complete_cpuset (hwloc_topology_ttopology) [static] Get complete CPU set. Returns: the complete CPU set of logical processors of the system. If the topology is the result of a combination of several systems, NULL is returned. Note: The returned cpuset is not newly allocated and should thus not be changed or freed; hwloc_cpuset_dup must be used to obtain a local copy. static inline hwloc_const_cpuset_t hwloc_topology_get_online_cpuset (hwloc_topology_ttopology) [static] Get online CPU set. Returns: the CPU set of online logical processors of the system. If the topology is the result of a combination of several systems, NULL is returned. Note: The returned cpuset is not newly allocated and should thus not be changed or freed; hwloc_cpuset_dup must be used to obtain a local copy. static inline hwloc_const_cpuset_t hwloc_topology_get_topology_cpuset (hwloc_topology_ttopology) [static] Get topology CPU set. Returns: the CPU set of logical processors of the system for which hwloc provides topology information. This is equivalent to the cpuset of the system object. If the topology is the result of a combination of several systems, NULL is returned. Note: The returned cpuset is not newly allocated and should thus not be changed or freed; hwloc_cpuset_dup must be used to obtain a local copy. Author Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code. Version 1.7 Sun Apr 7 2013 Cpuset Helpers(3)
All times are GMT -4. The time now is 12:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy