I have some code that opens a directory and reads in the names of files which are e.g. 0001, 0002, 0003 up to 9999I need to get all these numbers and then generate a new number that is not one of these numbers already.here is my code to check the files in the directory
1) I need to search a field value to check for exact 0. If the number is 0, it should throw error.
The line to be searched looks like as below. "Output Rows [1], Affected Rows [1], Applied Rows [1], Rejected Rows [0]"
Here I have to search whether the affected rows is 0. But the code below picks up other values also (lie 10, 20.. etc). How do we write to get an exact match for 0? Code: affected=`echo ${line} | cut -f6 -d" " `
affectedcount='echo ${affected} |grep 0 ` 2) Also, I need to check whether the rejected rows > 0 Code: rejected=`echo ${line} | cut -f12 -d" " ` rejectedcount='echo {rejected} |grep [1-9]`
3)Can we combine these two statements in a better way to get the desired results?
I'm having a hard time trying to get the number of digits in a uint64_t variable. The reason I'm using this is I want to make sure I get x amount of digits inside of a variable before I use it, but since the higher the digits, the better the program is.I currently use the following code, and it works, but my loop will never exit because the length is always 0:
Code:
/** * numbdigits() * number: The number to evaluate [in] * * Returns the number of digits found in a number.
[code]....
getrand() returns a uint64_t as well (and works). The only way the while() loop ends without my intervention is if I do curd += numdigits(val) instead...but, that gives a false value as well.
I have a text file that contains the following string of numbers and letters:
Code: Mean track length: 3.45 +/- 1.23 mm or
Code: Mean track length: 22.45 +/- 12.23 mm
In the first example, I would like to grab only 3.45 and write it into a new file. Then I would like to grab only 1.23 and write it into another file. I have 80,000 files to do and those numbers can be different every time.
How can I know what number descriptor is used by my usb device indicate via libusb_device_handle structure ? I can't find declaration of libusb_device_handle structure. I need this information to use poll() function where I need decripttion number of device.
How can I know what number descriptor is used by my usb device indicate via libusb_device_handle structure ? I can't find declaration of libusb_device_handle structure. I need this information to use poll() function where I need decripttion number of device.
In C, how can I declare multiple variables at once where the number that needs to be declared is unknown to the programmer.For example, a program that needs to declare some number of integers, but the user will tell the program how many integers to declare. Such as: x1 x2 x3 x4 x5 . . . Where the programmer doesn't know how many need to be declare you setup theinitialization?
I need to write a script which will get a number from STDIN and then with that number echo a set number of questions (its for a firewall config). Heres what I want the user to receive.
I am working on debian based OS and my query is,how to make detect the Number of NIC's plugged on a PC. I describe it: Exact requirement would, assume, If I plug 3 NIC's for a PC,one for Internal Network,one for External Network and Other remaining one for DMZ,so I need to make an application(Firewall Kind)in such a way that,once my PC is started,it should detect how many NIC's are plugged and Whats their role played(As Mentioned above)..? I hope u guys got a basic idea on what and how it it can be implemented.. I request to send some clues,or some related URL's/Tutorials or which part of the Linux File System needs to be edited(/etc or/proc),etc.
anyone know that the ntfs's file sytem struct? is there's a API or something other could let me get this number? Or there is actually no such number in windows like the number of inode in linux?
I have a file with 200 000 lines and I want to append the fields of each line based on matching first field. The resulting file should have 70 000 columns but has "only" 18 000. The command I'm using is working perfectly with a smaller file, wich lead to 14 000 columns. Could there be a limit in number of fields that awk can handle ? Here's my awk command :
Code:
awk -F, 'END { for (k in _) print _[k] } { _[$1] = $1 in _ ? _[$1] FS $4 : $1","$4 } ' file > out
Also, this command writes ^M (windows line break) after each columns. Removing them is easy but where do they come from ? Working on Ubuntu 10.10
i tried searching on google but found it difficult to say exactly what I was looking for.Task - Capitalise x number of letters at the start of words.eg. Original line - one.two.three.fourRevised line - One.Two.three.four (here only requiring 2 changes)Test data:
writing a program to find the prime numbers.i came to know that sieve of atkin is the most efficient algo to find the prime numbers.i am finding difficult to understand it