paste cut and watch in the same line


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers paste cut and watch in the same line
# 1  
Old 04-09-2012
paste cut and watch in the same line

Dear ULF followers,

I'm a newbie in this field (linux Smilie ), but I want to have some tools to help me in my work. One of them is to know exactely what runs in the cluster from my institute.

I notice that using cut and qstat allow me to see the ocupation of the cluster and other usefull things. Also
Code:
qstat -f|grep exec_host

can tell me on what nodes my apps are runing.

I would like to be able to write those on one-line command, and refresh the output (like watch does), but I'm having problems combining watch with cut and paste.

For example:

Code:
paste <(qstat -a|tail -n +6|cut -c1-4,21-30,40-55,67-73,87-94) <(qstat -f|grep exec_host|cut -c17-24)

works well, but when I try a

Code:
watch -n 1 'paste <(qstat -a|tail -n +6|cut -c1-4,21-30,40-55,67-73,87-94) <(qstat -f|grep exec_host|cut -c17-24) '

I receive the following error

Code:
sh: -c: line 0: syntax error near unexpected token `(' sh: -c: line 0: `paste <(qstat -a|tail -n +6|cut -c1-4,21-30,40-55,67-73,87-94) <(qstat -f|grep exec_host|cut -c17-24) '

Can anyone help me please? I thank you!

Moderator's Comments:
Mod Comment Welcome to the UNIX and Linux Forums. Please use code tags. Video tutorial on how to use them

Last edited by Scrutinizer; 04-09-2012 at 10:10 AM..
# 2  
Old 04-09-2012
Try:
Code:
watch -n 1 'bash -c "paste <(qstat -a|tail -n +6|cut -c1-4,21-30,40-55,67-73,87-94) <(qstat -f|grep exec_host|cut -c17-24)"'

# 3  
Old 04-09-2012
Dear bartus11, I saw you have more thanks (759) than posts(747); I just want to add many thanks to you. The code provided works. Thank you!

---------- Post updated at 09:21 PM ---------- Previous update was at 09:00 PM ----------

1 more question though, if I would assign an alias to
Code:
paste <(...) (...)

(for example "cluster"), how the watch command will look like? Thank you in advance!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem in cut or paste

Hello, I have some problem in cut or paste command for my text data. Input1.txt : I use cut command : cut -d ' ' -f1 Input1.txt > result.txt result.txt : Then, I use paste command to merge result.txt. paste -d ' ' result.txt Input1.txt > output.txt output.txt showed : I use cut... (1 Reply)
Discussion started by: awil
1 Replies

2. Shell Programming and Scripting

Issue with cut and paste

let i have A file and B file A has contains 4 fields as below ---------------- f1 f2 f3 f4 B file consists of 5 fields as below -------------------- f5 f6 f7 f8 f9 need to display as below output: f5 f1 f3 f8 f9 (2 Replies)
Discussion started by: ANSHUMAN1983
2 Replies

3. Shell Programming and Scripting

Problem in Cut and paste

Hi, I have a file like this --> Consider z as space #cat filename ABC <!--Nzzzzz--> <!--RESUMO--> EFG XYZ <!--Nzzzzz--> <!--RESUMO--> I need to cut the <!--RESUMO--> part and paste it to the previous line so that the file will look like this--> ABC <!--Nzzzzz--><!--RESUMO-->... (4 Replies)
Discussion started by: samsonata
4 Replies

4. UNIX for Dummies Questions & Answers

Cut paste from one file to other

Hello, I am working on unix for the first time. I have to write a shell script where i want to cut paste from one file to other. File "1234.abc" is 03,12345555 16,936,x,x,120 16,936,x,x,100 49,12345555 03,12347710 16,936,x,x,115 16,936,x,x,122 49,12347710 03,12342222... (9 Replies)
Discussion started by: swapsb
9 Replies

5. Shell Programming and Scripting

cut and paste

Hi, Need a help with shell script. I have to search for a string in one of the file, if match found, copy the line to a new file and delete the line from the exisiting file. eg: 83510000000000063800000.1800000.1600000.1600000.2400000.1800000.2000000.21... (6 Replies)
Discussion started by: gpaulose
6 Replies

6. Shell Programming and Scripting

cut and paste?

hi, I have a file with content like this for an employee: EmployeeID 101 Day_type, day vacation,1/2/2009 sick day, 3/2/2009 personal day, 4/5/2009 jury duty day, 5/5/2009 how do I make the result to show: EmployeeID,Day_type,day 101,vacation,1/2/2009 101,sick day,... (6 Replies)
Discussion started by: jbchen
6 Replies

7. UNIX for Dummies Questions & Answers

cut, copy + paste

Hi all! How do I cut, copy and paste under unix??? (2 Replies)
Discussion started by: aitor314
2 Replies

8. Shell Programming and Scripting

Cut Paste and Insert Help

Hello I have a very large file where say each line is made up of 80 characters. I want to cut the characters from 20-30 and 50-60 from each line and then insert a delimiter between them (# or | etc). eg input file 000000000131.12.20990000590425246363375670011200140406... (5 Replies)
Discussion started by: PradeepRed
5 Replies

9. Shell Programming and Scripting

cut & paste

hi i am new to shell scripting, i have been trying to cut columns numbered 1,4 of a file consisiting of 4 columns. Each column is seperated by 2 spaces. for example: john 6102097199 tennessee usa michel 6734590899 texas USA now, i need to cut the name... (3 Replies)
Discussion started by: t_harsha18
3 Replies

10. UNIX Desktop Questions & Answers

Cut, Copy and Paste with X

One of the things that I have learned to take for granted in the Win32 world is the cut, copy and paste hotkeys of ^X, ^C and ^V. I use these keys all the time under Win32 to copy and paste information from one GUI into another GUI. My question is, does X have a similiar standard? ... (4 Replies)
Discussion started by: auswipe
4 Replies
Login or Register to Ask a Question