Minimize command line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Minimize command line
# 1  
Old 02-03-2011
Minimize command line

Hello,

I am looking for help to minimize this commande line. The commande is working fine but I tried to make it shorter ... It's about to get rid of some characters.

Code:
 | sed '/NODE*/d' | cut -d "'" -f 2  | sed '/;;/d' |  sed '/[*]/d'  | sed 's/[ ]//g'

Thanks for your help
# 2  
Old 02-03-2011
what is your input (format) / output expected?
# 3  
Old 02-03-2011
Hello Tytalus,

here is the output format :

Code:
;;
NODE='/OPERATIONNEL/SATURNE/PHYS_MOD/NOWCAST                                                          ';;
 FILE='/OPERATIONNEL/SATURNE/PHYS_MOD/NOWCAST/SATURNE_1DAV_20110119_20110120_GRIDKZLN10_R20110126.NC.GZ                                                                ';;

Here is what I am lokking for

Code:
/OPERATIONNEL/SATURNE/PHYS_MOD/NOWCAST/SATURNE_1DAV_20110119_20110120_GRIDKZLN10_R20110126.NC.GZ

Thanks
# 4  
Old 02-03-2011
how about:

Code:
#  nawk -F"'" '/FILE=/{gsub(" ","",$2);print $2}' infile 
/OPERATIONNEL/SATURNE/PHYS_MOD/NOWCAST/SATURNE_1DAV_20110119_20110120_GRIDKZLN10_R20110126.NC.GZ

This User Gave Thanks to Tytalus For This Post:
# 5  
Old 02-03-2011
Your a real master. Thank you so much ...
# 6  
Old 02-04-2011
Code:
awk -F"[' ]" '/FILE=/{print $3}' infile

# 7  
Old 02-04-2011
One way through sed..
Code:
sed -n "/FILE/s/.*'//p" inputfile > outfile

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl command line option '-n','-p' and multiple files: can it know a file name of a printed line?

I am looking for help in processing of those options: '-n' or '-p' I understand what they do and how to use them. But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.) I did try it and -n works on 2 files. Question is: - is it possible to... (6 Replies)
Discussion started by: alex_5161
6 Replies

2. Shell Programming and Scripting

Looking to minimize 'for' loops in script

Hi, Below is the script that I came up with but looking to see if there is a more appropriate way to achieve this by reducing number of "for" loops or something. Regards, mbak #!/usr/bin/ksh status=missing for disk in `lspv | awk '{print $1}'` do MISSPATH=`lspath -l ${disk} -s... (3 Replies)
Discussion started by: mbak
3 Replies

3. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

4. UNIX for Dummies Questions & Answers

To find and display the middle line in a file using single line command.

Hi all, How can i display the middle line of a file using a single line command? (6 Replies)
Discussion started by: Lakme Pemmaiah
6 Replies

5. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

6. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

7. UNIX for Advanced & Expert Users

Conky apps key binding so that no need to minimize the windows open to see desktop

Hi I would like to ask if someone try or is there any key binding about the conky apps..I would like to know if it possible to key bind the conky running in desktop so that everytime i want to see the running conkyrc on the desktop there is no need for me to minimize the open windows inorder... (0 Replies)
Discussion started by: jao_madn
0 Replies

8. UNIX for Dummies Questions & Answers

Equivalent unix command to minimize/maximize xterm window

To all experts, I need some advice on how I can enter a unix command which is equivalent to the action of minimizing/maximizing an active xterm window. How can I do this (i) when control is in the active xterm window to be minimized/maximized , & (ii) when control is in a xterm window which runs... (0 Replies)
Discussion started by: icemocha75
0 Replies

9. UNIX for Dummies Questions & Answers

Minimize ksh

Dear, Have any command which can minimize the ksh windows? I use telnet to connect to server. Wilson (7 Replies)
Discussion started by: wilsonchan1000
7 Replies
Login or Register to Ask a Question