Hi
My requirement is to read the contents of a fixed length file and validate the same.
But am not able to read the contents of the file and when i tried it to print i get <blank> as an output...
I used the below satatements for printing the contents
... (3 Replies)
Hi Friends,
I am new to this forum. Just struck up with a logic.
I have a csv file seperated by ":" (colons).
This csv file contains hostname and groups as follows:
HOSTNAME:VT Group
SGSGCT2AVPX001:Team1
SGSGCT2AVPX003:Team2
SGSGCT2AVPX005:Team2
PHMNCTTAVPX001:Team3
I want to... (2 Replies)
Hi,
Need help in writing a script to read the contents of this file test
Test
00a
00b
00c
00d
00e
00f
where it need to read each line to give a display such as
form meta from dev 00a , config=Striped; add dev 00b:00f to meta 00a
Can any one help me in writing this script (2 Replies)
My file is in this format :
username : student information : default shell : student ID
Eg :
joeb:Joe Bennett:/bin/csh:1234
jerryd:Jerry Daniels:/bin/csh:2345
deaverm: Deaver Michelle:/bin/bash:4356
joseyg:Josey Guerra:/bin/bash:8767
michaelh:Michael Hall:/bin/ksh:1547
I have to... (1 Reply)
I have made a script something like this. I want it to read the contents of either file or directory but 'cat' and 'ls' is not working. Can anyone help me? I am a newbie in scripting so dont know much about it. I also dont know how can i put my code separatly on this forum
#!/bin/bash
echo... (9 Replies)
Hi, I'm trying to implement a C program on ubuntu which reads the contents of a file that is passed in as an argument and then displays it to the screen. So far I've cobbled together this from bits online but most of it is probably wrong as its all copied and pasted...
#include <stdio.h>... (2 Replies)
Hi,
I am kind of new at awk programming, so any help would be great !
I am trying to read a date from a file into a variable and a count into another variable and display both these variables.
The file looks like the attached file...
I tried this but it doesn't work ...
... (6 Replies)
Hi,
I am facing issue while reading data from a file in UNIX. my requirement is to compare two files and for the text pattern matching in the 1st file, replace the contents in second file by the contents of first file from start to the end and write the contents to thrid file.
i am able to... (2 Replies)
Hello,
I have a set of files Xfile0001 - Xfile0021, and the content of this files (one at a time) needs to be printed between some line (lines start with word "Generated") that I am extracting from another file called file7.txt and all the output goes into output.txt. First I tried creating a for... (5 Replies)
Trying to use sed to insert the contents of a file into the end of each line in another file
file1
This is a line
Here is another line
This is yet another line
Here is a fourth line
file2
TEXT
desired output
This is a line TEXT
Here is another line TEXT
This is yet another... (6 Replies)
Discussion started by: jimmyf
6 Replies
LEARN ABOUT LINUX
__ppc_get_timebase
__PPC_GET_TIMEBASE(3) Linux Programmer'sManual __PPC_GET_TIMEBASE(3)NAME
__ppc_get_timebase, __ppc_get_timebase_freq - get the current value
of the Time Base Register on Power architecture and its frequency.
SYNOPSIS
#include <sys/platform/ppc.h>
uint64_t __ppc_get_timebase(void)
uint64_t __ppc_get_timebase_freq(void);
DESCRIPTION
__ppc_get_timebase() reads the current value of the Time Base Register and returns its value, while __ppc_get_timebase_freq() returns the
frequency in which the Time Base Register is updated.
The Time Base Register is a 64-bit register provided by Power Architecture processors. It stores a monotonically incremented value that is
updated at a system-dependent frequency that may be different from the processor frequency.
RETURN VALUE
__ppc_get_timebase() returns a 64-bit unsigned integer that represents the current value of the Time Base Register.
__ppc_get_timebase_freq() returns a 64-bit unsigned integer that represents the frequency at which the Time Base Register is updated.
VERSIONS
GNU C Library support for __ppc_get_timebase() has been provided since version 2.16 and __ppc_get_timebase_freq() has been available since
version 2.17.
CONFORMING TO
Both functions are nonstandard GNU extensions.
EXAMPLE
The following program will calculate the time, in microseconds, spent between two calls to __ppc_get_timebase().
Program source
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/platform/ppc.h>
/* Maximum value of the Time Base Register: 2^60 - 1.
Source: POWER ISA. */
#define MAX_TB 0xFFFFFFFFFFFFFFF
int
main(void)
{
uint64_t tb1, tb2, diff;
uint64_t freq = __ppc_get_timebase_freq();
printf("Time Base frequency = %"PRIu64" Hz
", freq);
tb1 = __ppc_get_timebase();
// Do some stuff...
tb2 = __ppc_get_timebase();
if (tb2 > tb1) {
diff = tb2 - tb1;
} else {
/* Treat Time Base Register overflow. */
diff = (MAX_TB - tb2) + tb1;
}
printf("Elapsed time = %1.2f usecs
",
(double) diff * 1000000 / freq );
exit(EXIT_SUCCESS);
}
SEE ALSO time(2), usleep(3)GNU C Library 2019-03-06 __PPC_GET_TIMEBASE(3)