how to eliminate the unused lines from output
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
-2
down vote
favorite
I am new to scripting I got below output from my script.
OUTPUT:
/opt/soft/was85qa/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/elmd_qa/variables.xml
How to eliminate below lines
/opt/soft/
/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/
/variables.xml
final output should be like below
was85qa & elmd_qa
command-line scripts text-processing playonlinux
add a comment |Â
up vote
-2
down vote
favorite
I am new to scripting I got below output from my script.
OUTPUT:
/opt/soft/was85qa/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/elmd_qa/variables.xml
How to eliminate below lines
/opt/soft/
/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/
/variables.xml
final output should be like below
was85qa & elmd_qa
command-line scripts text-processing playonlinux
Please tell us what you're trying to do, and where this paths (?) are coming from ? With the information given, we can provide you with MANY useless non-generic options. Read this.
â RoVo
Feb 7 at 16:13
Is it always the same that you have to eliminate? Does it depende on the depth of the folders? The name?...
â M. Becerra
Feb 7 at 16:14
its always the same I need to eliminate
â mrr
Feb 7 at 16:15
@RoVo I am extracting the output from one of my file
â mrr
Feb 7 at 16:16
add a comment |Â
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I am new to scripting I got below output from my script.
OUTPUT:
/opt/soft/was85qa/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/elmd_qa/variables.xml
How to eliminate below lines
/opt/soft/
/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/
/variables.xml
final output should be like below
was85qa & elmd_qa
command-line scripts text-processing playonlinux
I am new to scripting I got below output from my script.
OUTPUT:
/opt/soft/was85qa/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/elmd_qa/variables.xml
How to eliminate below lines
/opt/soft/
/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/
/variables.xml
final output should be like below
was85qa & elmd_qa
command-line scripts text-processing playonlinux
command-line scripts text-processing playonlinux
edited Feb 7 at 16:13
asked Feb 7 at 16:08
![](https://lh4.googleusercontent.com/-OW_25tMOw-M/AAAAAAAAAAI/AAAAAAAALew/87PsQC0jqJM/photo.jpg?sz=32)
![](https://lh4.googleusercontent.com/-OW_25tMOw-M/AAAAAAAAAAI/AAAAAAAALew/87PsQC0jqJM/photo.jpg?sz=32)
mrr
12
12
Please tell us what you're trying to do, and where this paths (?) are coming from ? With the information given, we can provide you with MANY useless non-generic options. Read this.
â RoVo
Feb 7 at 16:13
Is it always the same that you have to eliminate? Does it depende on the depth of the folders? The name?...
â M. Becerra
Feb 7 at 16:14
its always the same I need to eliminate
â mrr
Feb 7 at 16:15
@RoVo I am extracting the output from one of my file
â mrr
Feb 7 at 16:16
add a comment |Â
Please tell us what you're trying to do, and where this paths (?) are coming from ? With the information given, we can provide you with MANY useless non-generic options. Read this.
â RoVo
Feb 7 at 16:13
Is it always the same that you have to eliminate? Does it depende on the depth of the folders? The name?...
â M. Becerra
Feb 7 at 16:14
its always the same I need to eliminate
â mrr
Feb 7 at 16:15
@RoVo I am extracting the output from one of my file
â mrr
Feb 7 at 16:16
Please tell us what you're trying to do, and where this paths (?) are coming from ? With the information given, we can provide you with MANY useless non-generic options. Read this.
â RoVo
Feb 7 at 16:13
Please tell us what you're trying to do, and where this paths (?) are coming from ? With the information given, we can provide you with MANY useless non-generic options. Read this.
â RoVo
Feb 7 at 16:13
Is it always the same that you have to eliminate? Does it depende on the depth of the folders? The name?...
â M. Becerra
Feb 7 at 16:14
Is it always the same that you have to eliminate? Does it depende on the depth of the folders? The name?...
â M. Becerra
Feb 7 at 16:14
its always the same I need to eliminate
â mrr
Feb 7 at 16:15
its always the same I need to eliminate
â mrr
Feb 7 at 16:15
@RoVo I am extracting the output from one of my file
â mrr
Feb 7 at 16:16
@RoVo I am extracting the output from one of my file
â mrr
Feb 7 at 16:16
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
If the text is always the same, you can just use sed
search and replace function and hard-code what needs to be excluded:
echo $OUTPUT | sed -r 's#/opt/soft/([^/]*)/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/([^/]*)/variables.xml#1 & 2#'
You could also use cut
, because if it's always the same, the strings you're looking for are always on the same position (--> 4 and 11).
echo $OUTPUT | cut -d'/' -f 4,11 --output-delimiter=" & "
Instead of echo $OUTPUT
you can add the part beginning with the pipe (|
) directly behind your command to run the script.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
If the text is always the same, you can just use sed
search and replace function and hard-code what needs to be excluded:
echo $OUTPUT | sed -r 's#/opt/soft/([^/]*)/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/([^/]*)/variables.xml#1 & 2#'
You could also use cut
, because if it's always the same, the strings you're looking for are always on the same position (--> 4 and 11).
echo $OUTPUT | cut -d'/' -f 4,11 --output-delimiter=" & "
Instead of echo $OUTPUT
you can add the part beginning with the pipe (|
) directly behind your command to run the script.
add a comment |Â
up vote
1
down vote
If the text is always the same, you can just use sed
search and replace function and hard-code what needs to be excluded:
echo $OUTPUT | sed -r 's#/opt/soft/([^/]*)/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/([^/]*)/variables.xml#1 & 2#'
You could also use cut
, because if it's always the same, the strings you're looking for are always on the same position (--> 4 and 11).
echo $OUTPUT | cut -d'/' -f 4,11 --output-delimiter=" & "
Instead of echo $OUTPUT
you can add the part beginning with the pipe (|
) directly behind your command to run the script.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
If the text is always the same, you can just use sed
search and replace function and hard-code what needs to be excluded:
echo $OUTPUT | sed -r 's#/opt/soft/([^/]*)/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/([^/]*)/variables.xml#1 & 2#'
You could also use cut
, because if it's always the same, the strings you're looking for are always on the same position (--> 4 and 11).
echo $OUTPUT | cut -d'/' -f 4,11 --output-delimiter=" & "
Instead of echo $OUTPUT
you can add the part beginning with the pipe (|
) directly behind your command to run the script.
If the text is always the same, you can just use sed
search and replace function and hard-code what needs to be excluded:
echo $OUTPUT | sed -r 's#/opt/soft/([^/]*)/WebSphere/gct8apps_qa_node/config/cells/gct8apps_qa_cell/clusters/([^/]*)/variables.xml#1 & 2#'
You could also use cut
, because if it's always the same, the strings you're looking for are always on the same position (--> 4 and 11).
echo $OUTPUT | cut -d'/' -f 4,11 --output-delimiter=" & "
Instead of echo $OUTPUT
you can add the part beginning with the pipe (|
) directly behind your command to run the script.
edited Feb 7 at 16:31
answered Feb 7 at 16:24
RoVo
5,8091338
5,8091338
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1003935%2fhow-to-eliminate-the-unused-lines-from-output%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Please tell us what you're trying to do, and where this paths (?) are coming from ? With the information given, we can provide you with MANY useless non-generic options. Read this.
â RoVo
Feb 7 at 16:13
Is it always the same that you have to eliminate? Does it depende on the depth of the folders? The name?...
â M. Becerra
Feb 7 at 16:14
its always the same I need to eliminate
â mrr
Feb 7 at 16:15
@RoVo I am extracting the output from one of my file
â mrr
Feb 7 at 16:16