help needed with sort. pipe and popen()


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers help needed with sort. pipe and popen()
# 8  
Old 05-21-2007
fptr = popen("/bin/bash -c \"sort file1 | uniq -c | wc -l; echo ${PIPESTATUS[0] > some_file\"" , "r");

Ie, run the whole thing under bash?

btw, I meant bash not ksh.

Also, yes I recommend you don't rely on shell specifics. In scripts try and limit yourself to "sh".
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk pipe to sort

In the below awk to add a sort by smallest to largest should it be added after the END? Thank you :). BEGIN { FS="*" } # Read search terms from file1 into 's' FNR==NR { s next } { # Check if $5 matches one of the search terms for(i in s) { if($5 ~ i) { ... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

Sort file using pipe

I am trying to create a file (epilepsy70_average.txt) and then pipe that file into a sort and save a new file. The new file is sort.txt but as of know it is blank. I can create the file in one command and then sort it in another. Is the pipe not correct? Thank you :). awk... (2 Replies)
Discussion started by: cmccabe
2 Replies

3. SuSE

Is this iostat pipe to sort service request command correct?

Hi, my os is SLES 10 from sort iostat as my output does not include rkB/s and wkB/s I probably have to adjust the key position, so is the following iostat pipe to sort service request command correct? oracle@vmc_stallite:~> iostat -x | sort -nrk11 sda 0.96 ... (4 Replies)
Discussion started by: jediwannabe
4 Replies

4. Shell Programming and Scripting

sort command help needed

I have a file with three fields of data for example say we have 1420 $12.56 45 3456 $15.89 14 2341 $25.87 32 I need to use a command to show who is getting paid the highest amount to standard output. I am not sure if I should use a sort command or a copy and paste... (1 Reply)
Discussion started by: drew211
1 Replies

5. Shell Programming and Scripting

Help needed to sort data

Hello All, Today i have been asking lots of question, hope to become good in scripting soon with all the wonderful advices i get. The question is i want to sort data a get uniq string from it. The code i am using to generate the output is:- check_sun() { for i in $SUN_PLATFORM do $ECHO... (0 Replies)
Discussion started by: asirohi
0 Replies

6. Shell Programming and Scripting

Help needed with Sort and uniq data

Hi All, After Sorting directories and files i have got following output as below, now i only want the strings common in them, so the actual output should be as below in the bottom. How do i do that? Thanks -adsi File to be modified:- Common Components for ----> AA... (4 Replies)
Discussion started by: asirohi
4 Replies

7. Shell Programming and Scripting

sort command help needed.

Hello, suppose i have a student.dat file whose format is studentno studentname semester marks1 marks2 marks3 total then how can i sort first in semester wise and then total wise? I mean semester wise ranking wise record should be displayed. Semester should be displayed in ascending order... (6 Replies)
Discussion started by: salman4u
6 Replies

8. Shell Programming and Scripting

Help needed in removing intermediate segments from a pipe delimited segment file

Hi, I just stuckup in doing some regular expressions on a file. I have data which has multiple FHS and BTS segments like: FHS|12121|LOCAL|2323 MSH|10101|POTAMAS|2323 PID|121221|THOMAS|DAVID|23432 OBX|2342|H1211|3232 BTS|0000|MERSTO|LIABLE FHS|12121|LOCAL|2323 MSH|10101|POTAMAS|2323... (3 Replies)
Discussion started by: naren_0101bits
3 Replies

9. Shell Programming and Scripting

Help needed to sort file

I have a text file comprising of 3 columns 1. First column - numeric count/frequency of error codes 2. Second column - alphanumeric hyphenated error code 3. Third column - Error code description (alphanumeric) 184 ABCD-954 Errorcodedescription1 35645 DFMS-323 Errorcodedescription2 43534 ... (2 Replies)
Discussion started by: inditopgun
2 Replies

10. UNIX for Dummies Questions & Answers

Sort - Help Needed

Hi, I am facing a small problem while I am doing the sort. Problem Definition: I have a file which has the following data. >cat test.dat zxzxc asdasd qwaxcZa qwaxcA When I do a sort on this file. the result set is asdasd qwaxcA (4 Replies)
Discussion started by: Andysundar
4 Replies
Login or Register to Ask a Question
JOIN(1) 						      General Commands Manual							   JOIN(1)

NAME
join - relational database operator SYNOPSIS
join [ options ] file1 file2 DESCRIPTION
Join forms, on the standard output, a join of the two relations specified by the lines of file1 and file2. If file1 is `-', the standard input is used. File1 and file2 must be sorted in increasing ASCII collating sequence on the fields on which they are to be joined, normally the first in each line. There is one line in the output for each pair of lines in file1 and file2 that have identical join fields. The output line normally con- sists of the common field, then the rest of the line from file1, then the rest of the line from file2. Fields are normally separated by blank, tab or newline. In this case, multiple separators count as one, and leading separators are dis- carded. These options are recognized: -an In addition to the normal output, produce a line for each unpairable line in file n, where n is 1 or 2. -e s Replace empty output fields by string s. -jn m Join on the mth field of file n. If n is missing, use the mth field in each file. -o list Each output line comprises the fields specifed in list, each element of which has the form n.m, where n is a file number and m is a field number. -tc Use character c as a separator (tab character). Every appearance of c in a line is significant. SEE ALSO
sort(1), comm(1), awk(1) BUGS
With default field separation, the collating sequence is that of sort -b; with -t, the sequence is that of a plain sort. The conventions of join, sort, comm, uniq, look and awk(1) are wildly incongruous. JOIN(1)