The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with unix command niks UNIX for Dummies Questions & Answers 3 02-09-2009 02:45 PM
assign a command line argument and a unix command to awk variables sweta_doshi Shell Programming and Scripting 0 08-08-2008 06:54 AM
How to use more than one MPE command STREAM with Unix command in a single shell? bosskr HP-UX 1 10-16-2006 04:16 PM
How to use more than one MPE command STREAM with Unix command in a single shell? bosskr Shell Programming and Scripting 0 09-19-2006 09:44 PM
wc command help.... and other unix command....... urgent dashi2k UNIX for Dummies Questions & Answers 1 01-20-2005 06:39 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-21-2009
rsampathy rsampathy is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 4
HP Unix Tee command.

work.txt
Code:
M|324324|32424|3431
N|324324|32426|3432
N|324324|32424|3434
M|324324|32424|3435
AIX command:
Code:
cat work.txt | tee >( grep '^M' > m.txt ) >( grep '^N' > n.txt )
which does not work on HP? Please adivse us.
Error:
Code:
cat work.txt | tee >( grep '^M' > m.txt ) >( grep '^N' > n.txt )
ksh: syntax error: `(' unexpected

Last edited by vgersh99; 09-21-2009 at 09:56 AM.. Reason: code tags, PLEASE!
  #2 (permalink)  
Old 09-21-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,728
Code:
awk ' /^M/ {print $0 > "m.txt"}
       /^N/  {print $0 > "n.txt" } ' inputfile
  #3 (permalink)  
Old 09-21-2009
rsampathy rsampathy is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 4
Thanks Jim. My code is below which does not work:

Code:
mkfifo $StdMarPbPipe1 && mkfifo $StdMarPbPipe2

ce_bcp.ksh -i out -d itg_credit -t samtmpv1 -f $StdMarPbPipe1 -F "|" -H "|" &

tee $StdMarPbPipe2 < ( $StdMarPbPipe1 | grep "^N" | cut -d '|' -f 2-4 | sort -u > TestMarPbN.txt) &

grep "^M" $StdMarPbPipe1 | cut -d '|' -f 2-4 | sort -u > TestMarPbM.txt


Objective is:

step1: Internal Bcp to -> pipe $StdMarPbPipe1

Then reading pipe1--> grep '^N' | cut | sort > TestMarPbN.txt
Then reading pipe2--> grep '^M' | cut | sort > TestMarPbM.txt

Like to use Tee command to avoid reading twice from pipe1.


Last edited by vgersh99; 09-21-2009 at 09:57 AM.. Reason: code tags, PLEASE!
  #4 (permalink)  
Old 09-21-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
  #5 (permalink)  
Old 09-21-2009
rsampathy rsampathy is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 4
Tee command using pipe

work text.txt:
M|324324|32424|3431
N|324324|32426|3432
N|324324|32424|3434
M|324324|32424|3435
mkfifo $pipe1 $pipe2
tee $Pipe2 < ( $pipe1 | grep "^N" | cut -d '|' -f 2-4 | sort -u > TestMarPbN.txt) &
grep "^M" Pipe1 | cut -d '|' -f 2-4 | sort -u > TestMarPbM.txt

Here reading twice from pipe1 -- instead of that can we read only once using tee command.
  #6 (permalink)  
Old 09-22-2009
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,574
Quote:
AIX command:
Code:

cat work.txt | tee >( grep '^M' > m.txt ) >( grep '^N' > n.txt )
Code:
an12:/home/vbe $ cat work.txt
M|324324|32424|3431
N|324324|32426|3432
N|324324|32424|3434
M|324324|32424|3435
an12:/home/vbe $ cat work.txt | tee >( grep '^M' > m.txt ) >( grep '^N' > n.txt )
ksh: 0403-057 Syntax error: `(' is not expected.
an12:/home/vbe $ oslevel
6.1.0.0
  #7 (permalink)  
Old 4 Weeks Ago
rwuerth rwuerth is offline
Registered User
  
 

Join Date: Jan 2009
Location: Va. Beach
Posts: 64
Quote:
Here reading twice from pipe1 -- instead of that can we read only once using tee command.
You're attempting process substitution, and that is only available on systems that support the /dev/fd/N special files for named access to previously opened file descriptors.

My hp-ux version (11.11) does not support this. I'm not sure if the newer versions are supposed to support it or not.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0