Sponsored Content
Full Discussion: Usage of Int with NR in awk
Top Forums Shell Programming and Scripting Usage of Int with NR in awk Post 302912453 by saratha14 on Friday 8th of August 2014 11:03:35 AM
Old 08-08-2014
Yeah.
Code:
awk '{filename = "sample_file" int((NR-1)/34) ".DAT"; print >> filename}' sample_file.DAT

In that code, so this is how I understand,
first iteration , it reads till 34th line 34-1/34 and it will put 0 and the file name will be sample_file0.DAT and then it will print till that line into that file sample_file0.DAT... the second iteration it will be 68-1/34 and it will round the integer to 1 and the file name will be sample_file1.DAT and so on.. Is it correct.?
 

10 More Discussions You Might Find Interesting

1. Programming

difference between int ** func() and int *& func()

What is the difference between int** func() and int*& func(). Can you please explain it with suitable example. Thanks, Devesh. (1 Reply)
Discussion started by: devesh
1 Replies

2. UNIX for Dummies Questions & Answers

int open(const char *pathname, int flags, mode_t mode) doubt...

hello everybody! I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(){ int fileDescriptor; fileDescriptor =... (2 Replies)
Discussion started by: csnmgeek
2 Replies

3. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

4. Shell Programming and Scripting

problem in awk int() function

awk -vwgt=$vWeight -vfac=$vFactor ' BEGIN { printf("wgt:" wgt "\n"); printf("factor:" fac "\n"); total = sprintf("%.0f", wgt * fac); total2 = sprintf("%.0f", int(wgt * fac)); printf("total:" total "\n"); printf("total2:" total2 "\n"); } ' if vWeight=326.4 vFactor=100 the result... (2 Replies)
Discussion started by: qa.bingo
2 Replies

5. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

6. Shell Programming and Scripting

Awk issue using int function

Hi, I am having issue with awk command . This command is running in the command prompt but inside a shell script. awk -F'| ' 'int($1)==$1 && int($3) ==$3' int_check.txt $cat int_check.txt 123|abc|123x 234|def|345 When i run it inside a shell script i am getting the error "bailing... (5 Replies)
Discussion started by: ashwin3086
5 Replies

7. Programming

Handle int listen(int sockfd, int backlog) in TCP

Hi, from the manual listen(2): listen for connections on socket - Linux man page It has a parameter called backlog and it limits the maximum length of queue of pending list. If I set backlog to 128, is it means no more than 128 packets can be handled by server? If I have three... (3 Replies)
Discussion started by: sehang
3 Replies

8. Shell Programming and Scripting

Advanced AWK Regexp substring to int & Replace

Hi! I have a difficult problem, to step up a unknown version number in a text file, and save the file. It would be great to run script.sh and the version gets increased. Example the content of the textfile.txt hello version = x bye This include three steps 1. First find the char after... (2 Replies)
Discussion started by: Beachboy72
2 Replies

9. Shell Programming and Scripting

Help with awk - Disk usage

Hi All, Would appreciate your help as to why the following code not showing the correct output. the issue is on the last else cause. I am trying to report on disk space based on percentage usage. for some reason, it's showing output as OK even thou disk space is 90% !!!! any ideas why? thanks!!... (2 Replies)
Discussion started by: xcod3r
2 Replies

10. Shell Programming and Scripting

awk usage

Hi I have a file like this user="joe" phone="4280919" duration=128 login=12/02/2016 ip-address=10.230.120.35 user="mary" phone="6352728" duration=23 login=16/02/2016 ip-address=10.123.231.54 I have to convert these to as follows (csv format) (Ignore Login field)... (6 Replies)
Discussion started by: Balav
6 Replies
datadm(1M)																datadm(1M)

NAME
datadm - maintain DAT static registry file SYNOPSIS
/usr/bin/datadm [-v] [-u] [-a service_provider.conf] [-r service_provider.conf] The datadm utility maintains the DAT static registry file, dat.conf(4). This administrative configuration program allows uDAPL service providers to add and remove themselves to the dat.conf file. You can add or remove interface adapters that a service provider supports from a system after its installation. You can use datadm to update the dat.conf file to reflect the current state of the system. A new set of interface adapters for all the service providers cur- rently installed is regenerated. The following options are supported: -a service_provider.conf Enumerate each device entry in the service_provider.conf(4) file into a list of interface adapters, that is, interfaces to external network that are available to uDAPL consumers. -r service_provider.conf Remove the list of interface adapters that corresponds to the device entry in the service_provider.conf(4) file. -u Update the dat.conf to reflect the current state of the system with an up to date set of interface adapters for the service providers that are currently listed in the DAT static registry. -v Display the DAT static registry file, dat.conf. Example 1: Enumerating a Device Entry The following example enumerates a device entry in the service_provider.conf(4) file into interface adapters in the dat.conf(4) file. Assume that SUNW has a service provider library that supports the device tavor. It has a service_provider.conf(4) file installed in the directory /usr/share/dat/SUNWudaplt.conf with a single entry as follows: driver_name=tavor u1.2 nonthreadsafe default udapl_tavor.so.1 SUNW.1.0 "" tavor is an Infiniband Host Channel Adapter with two ports. Both IB ports exist in a single IB partition, 0x8001. If an IP interface is plumbed to each port, there are two IPoIB device instances, ibd0 and ibd1: # ls -l /dev/ibd* /dev/ibd0 -> /devices/pci@1/pci15b3,5a44@0/ibport@1,8001,ipib:ibd0 /dev/ibd1 -> /devices/pci@1/pci15b3,5a44@0/ibport@2,8001,ipib:ibd1 Running the command, datadm -a /usr/share/dat/SUNWudaplt.conf appends two new entries (if they do not already exists]) in the /etc/dat/dat.conffile: ibd0 u1.2 nonthreadsafe default udapl_tavor.so.1 SUNW.1.0 "" "driver_name=tavor" ibd1 u1.2 nonthreadsafe default udapl_tavor.so.1 SUNW.1.0 "" "driver_name=tavor" Example 2: Updating the dat.conf to Reflect the Current State of the System A new IB partition, 0x8002 is added to the above example covering port 1 of the Host Channel Adapter. If a new IP interface is plumbed to port 1/partition 0x8002, there is a third IPoIB device instance: ibd2. # ls -l /dev/ibd* /dev/ibd0 -> /devices/pci@1/pci15b3,5a44@0/ibport@1,8001,ipib:ibd0 /dev/ibd1 -> /devices/pci@1/pci15b3,5a44@0/ibport@2,8001,ipib:ibd1 /dev/ibd2 -> /devices/pci@1/pci15b3,5a44@0/ibport@1,8002,ipib:ibd2 Running datadm -u command, updates the /etc/dat/dat.conf file with a new entry added reflecting the current state of the system. datadm -v shows that there are now three entries in the /etc/dat/dat.conf file: ibd0 u1.2 nonthreadsafe default udapl_tavor.so.1 SUNW.1.0 "" "driver_name=tavor" ibd1 u1.2 nonthreadsafe default udapl_tavor.so.1 SUNW.1.0 "" "driver_name=tavor" ibd2 u1.2 nonthreadsafe default udapl_tavor.so.1 SUNW.1.0 "" "driver_name=tavor" /etc/dat/dat.conf DAT static registry file See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWudaplu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ pkgadd(1M), pkgrm(1M), libdat(3LIB), dat.conf(4), service_provider.conf(4). attributes(5) 18 Jun 2004 datadm(1M)
All times are GMT -4. The time now is 11:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy