Sponsored Content
Top Forums Shell Programming and Scripting Seperate Odd and Even numbers from 1 file to 2 files Post 302946697 by blackrageous on Thursday 11th of June 2015 12:27:39 PM
Old 06-11-2015
Code:
cat numberfile.txt | while read num
do

        if [ `echo "${num} % 2" | bc` -eq 0 ] 
        then  
                echo ${num} >> even.numbers.txt
        else
                echo ${num} >> odd.numbers.txt
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I stop printf output from going into seperate txt files

I am using printf "%-75s%+10s %5s %1s \n" $s $z $x $y > status It works really well, however, when I email status it is sending 10 emails when I would like it to be in one. Is there a way to make all the output to go into one instance of a txt file. Yet still keep it 1 on each... (12 Replies)
Discussion started by: chrchcol
12 Replies

2. Shell Programming and Scripting

how to remove files with only numbers as file names?

Hi all, I have a bunch of files that are named like 12543, 467249877, etc all over some directories.These files are named only with numbers, they dont have any letters or special characters in their file names. Could you please help me out and give me some command/script to remove only those... (6 Replies)
Discussion started by: praveen_indramo
6 Replies

3. Shell Programming and Scripting

Email like files in seperate emails

My goal is to send multiple files to a person based on their input. The files have similar names like: file1-egress-filter file2-ingress-filter stuff1-egress-filter stuff2-ingress-filter ... The script is run with the filename given as arguments, such as: ./mail.sh file stuff would... (6 Replies)
Discussion started by: earnstaf
6 Replies

4. Shell Programming and Scripting

Split File into seperate files

Hi, So I have a text file which I want to separate into separate text files. I would use the split command but the problem here is that the text file is separated by delimiters. For example: blah blah blah ------ more text ----- and some more text So basically the first part should be... (4 Replies)
Discussion started by: eltinator
4 Replies

5. UNIX for Dummies Questions & Answers

comparing strings in seperate files

Hello, I am comparing files with for mismatches using fgrep but I've run into a problem. fgrep -vf $file1 $file2 > mismatches.dat file1 and file2 both contain file names on each line file1 has filenames which are up to 92 characters long and contain the "$" char. example file name:... (2 Replies)
Discussion started by: orahi001
2 Replies

6. UNIX for Dummies Questions & Answers

extract only the "numbers" that are present in this file to a seperate file..

It may sounds too easy but appreciate any help on this.. i have a file with the below details: ****************************************** Please find the locked pernr details for the Time evaluation Personnel number could not be locked Person rejected: 04552737 Personnel number could not... (4 Replies)
Discussion started by: rohit.shetty84
4 Replies

7. UNIX for Dummies Questions & Answers

finding files with numbers in the file name???

Hello all, New to this forum! I got a Q: i want to find all files with numbers in the file name. e.g. blabla234.pm or fool654.pl action i took: ls | egrep '+' ls | egrep ls | egrep + ls | egrep '' ls | egrep '(+)' ls | egrep '()' ls | egrep '(.*.*)' ls | egrep '.*.*' ls | grep... (2 Replies)
Discussion started by: RedGrinGo
2 Replies

8. Shell Programming and Scripting

Help with command to Move files by X number to seperate directories

Hello, I need help finding a script that will allow me to move files from one directory to another directory 10k files at a time. I have a directory that has 100 K files in it. I need to have those 100k files broken apart to separate directories each with 10k files in them. Here is the... (8 Replies)
Discussion started by: Geo_Bean
8 Replies

9. UNIX for Dummies Questions & Answers

looping through file and creating seperate files

Hi, My first post!! I have a files with header, something like this Header_Row AMC|D1|D2|D2 AAO|D3|D4|D5 AMC|D6|D7|D8 AAO|D9|D10|D11 . . . . . and millions fo records thereafter like this. I want to read the above file in a loop and write the lines having AMC into another... (1 Reply)
Discussion started by: amitbakre
1 Replies

10. UNIX for Beginners Questions & Answers

For loop for seperate files

For shell script. If I had two separate files, file.txt and file1.txt and each has just a list of names from the who command. How would I create an if loop to compare each name? (1 Reply)
Discussion started by: Eric7giants
1 Replies
COMPLEX(7)						     Linux Programmer's Manual							COMPLEX(7)

NAME
complex - basics of complex mathematics SYNOPSIS
#include <complex.h> DESCRIPTION
Complex numbers are numbers of the form z = a+b*i, where a and b are real numbers and i = sqrt(-1), so that i*i = -1. There are other ways to represent that number. The pair (a,b) of real numbers may be viewed as a point in the plane, given by X- and Y- coordinates. This same point may also be described by giving the pair of real numbers (r,phi), where r is the distance to the origin O, and phi the angle between the X-axis and the line Oz. Now z = r*exp(i*phi) = r*(cos(phi)+i*sin(phi)). The basic operations are defined on z = a+b*i and w = c+d*i as: addition: z+w = (a+c) + (b+d)*i multiplication: z*w = (a*c - b*d) + (a*d + b*c)*i division: z/w = ((a*c + b*d)/(c*c + d*d)) + ((b*c - a*d)/(c*c + d*d))*i Nearly all math function have a complex counterpart but there are some complex-only functions. EXAMPLE
Your C-compiler can work with complex numbers if it supports the C99 standard. Link with -lm. The imaginary unit is represented by I. /* check that exp(i * pi) == -1 */ #include <math.h> /* for atan */ #include <stdio.h> #include <complex.h> int main(void) { double pi = 4 * atan(1.0); double complex z = cexp(I * pi); printf("%f + %f * i ", creal(z), cimag(z)); } SEE ALSO
cabs(3), carg(3), cexp(3), cimag(3), creal(3) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2009-07-25 COMPLEX(7)
All times are GMT -4. The time now is 02:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy