unix

Is there an easy way of clearing a pipe in C

巧了我就是萌 提交于 2020-01-24 06:37:05
问题 I have a pipe that all my child processes use, but before a child uses the pipe to talk to the parent I need to clear it so that the parent reads from it correctly. Is there a simple function in C to do this? 回答1: The way to "clear" a pipe is to read from it until the buffer is empty. This doesn't help you. I am guessing that your real problem is that the parent might read data that is mixed from multiple clients. There are two easy solutions to your problem. Always write messages less than

Unable to build GNU automake

余生颓废 提交于 2020-01-24 04:15:31
问题 Installed automake using wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz ./configure --prefix=$HOME/local works fine for me. After this step, I ran make and it fails: GEN bin/automake GEN bin/aclocal GEN t/ax/shell-no-trail-bslash GEN t/ax/cc-no-c-o GEN runtest GEN lib/Automake/Config.pm GEN doc/aclocal-1.15.1 GEN doc/automake-1.15.1 help2man: can't get `--help' info from automake-1.15 Try `--no-discard-stderr' if option outputs to stderr make: *** [doc/automake-1.15.1] Error 2 I do

Unix- Using Grep to get unmatched lines

不羁的心 提交于 2020-01-24 00:35:34
问题 I am new to unix. I want to grep the unmatched pattern from a file1 provided that the patterns are in the file2. The real files are having more than 1000 lines. Example: File1: Hi(Everyone) How(u)people(are)doing? ThanksInadvance File2: Hi(Every ThanksI Required Result: How(u)people(are)doing? I want only the pattern to be used like ("Hi(Every") for the grep.It should return the unmatched line from file1. 回答1: this line works for given example: grep -Fvf file2 file1 The 3 options used above:

Unix- Using Grep to get unmatched lines

给你一囗甜甜゛ 提交于 2020-01-24 00:35:06
问题 I am new to unix. I want to grep the unmatched pattern from a file1 provided that the patterns are in the file2. The real files are having more than 1000 lines. Example: File1: Hi(Everyone) How(u)people(are)doing? ThanksInadvance File2: Hi(Every ThanksI Required Result: How(u)people(are)doing? I want only the pattern to be used like ("Hi(Every") for the grep.It should return the unmatched line from file1. 回答1: this line works for given example: grep -Fvf file2 file1 The 3 options used above:

How to divide float by integer when both are variables?

两盒软妹~` 提交于 2020-01-23 13:07:03
问题 I am writing a program in C. I have two variables one of which is integer and the other one is float. I want to divide the float by the integer and want to get result in float. I am doing the following: int a; float b=0,c=0; scanf("%d",&a); Here I am doing some computations on b so its value is increased randomly i.e 33 etc. c = b/(float)a; printf("c = %2.f\n", c); The problem is I am getting ' c ' as a rounded number (integer) rather than a float value. How can I get ' c ' as a float value.

How to divide float by integer when both are variables?

拈花ヽ惹草 提交于 2020-01-23 13:06:42
问题 I am writing a program in C. I have two variables one of which is integer and the other one is float. I want to divide the float by the integer and want to get result in float. I am doing the following: int a; float b=0,c=0; scanf("%d",&a); Here I am doing some computations on b so its value is increased randomly i.e 33 etc. c = b/(float)a; printf("c = %2.f\n", c); The problem is I am getting ' c ' as a rounded number (integer) rather than a float value. How can I get ' c ' as a float value.

What are the difference between double backslash and single slash in reg for .?

佐手、 提交于 2020-01-23 11:28:54
问题 Two commands below : grep ', \\.' enrolments grep ', \.' enrolments got the same result as shown below COMP4001|4368523|Doddau Yobhazravi, . |8684 |M COMP9315|4368523|Doddau Yobhazravi, . |8684 |M COMP9321|4368523|Doddau Yobhazravi, . |8684 |M COMP9331|4368523|Doddau Yobhazravi, . |8684 |M COMP3121|4896558|Vozaila, . |3978/3|F COMP9321|4896558|Vozaila, . |3978/3|F COMP9031|4389601|Yiehil, . |8680/2|M COMP9318|4389601|Yiehil, . |8680/2|M What are the difference between double backslash and

What are the difference between double backslash and single slash in reg for .?

☆樱花仙子☆ 提交于 2020-01-23 11:28:08
问题 Two commands below : grep ', \\.' enrolments grep ', \.' enrolments got the same result as shown below COMP4001|4368523|Doddau Yobhazravi, . |8684 |M COMP9315|4368523|Doddau Yobhazravi, . |8684 |M COMP9321|4368523|Doddau Yobhazravi, . |8684 |M COMP9331|4368523|Doddau Yobhazravi, . |8684 |M COMP3121|4896558|Vozaila, . |3978/3|F COMP9321|4896558|Vozaila, . |3978/3|F COMP9031|4389601|Yiehil, . |8680/2|M COMP9318|4389601|Yiehil, . |8680/2|M What are the difference between double backslash and

How to remove file with special characters? [duplicate]

不羁岁月 提交于 2020-01-23 10:56:52
问题 This question already has answers here : How to remove files starting with double hyphen? (7 answers) Closed last month . I have a weird file on a Unix filesystem. It seems to have some special characters in the file name, but I've not been able to remove it. Even if I don't write the name directly in the rm command (and I do ls | rm instead), I get an error that the file doesn't exist. Below some commands that I've tried after a few searches on the internet, in order to debug the issue. Do

How to remove file with special characters? [duplicate]

浪子不回头ぞ 提交于 2020-01-23 10:56:27
问题 This question already has answers here : How to remove files starting with double hyphen? (7 answers) Closed last month . I have a weird file on a Unix filesystem. It seems to have some special characters in the file name, but I've not been able to remove it. Even if I don't write the name directly in the rm command (and I do ls | rm instead), I get an error that the file doesn't exist. Below some commands that I've tried after a few searches on the internet, in order to debug the issue. Do