Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8011551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:03:01+00:00 2026-06-04T19:03:01+00:00

$df_ret = `ssh -q rajesh ‘df -hP’`; print "The value is $df_ret"; if ($df_ret

  • 0
$df_ret = `ssh -q rajesh 'df -hP'`;

print "The value is $df_ret";   

if ($df_ret =~ /\/boot/) 
{
    print "The value is $df_ret";
}

Expected result:

/dev/sda1               126931     39530     80848  33% /boot

But, it’s coming whole df -k output. Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:03:06+00:00Added an answer on June 4, 2026 at 7:03 pm

    Your regex is matching against the whole output as one string. You probably want to split it into lines, first and then match each line:

    my @df_ret = `ssh -q rajesh 'df -hP'`;
    
    foreach my $line (@df_ret) {
        if ($line =~ m! /boot$!)
        {
            print "The value is $line";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With the command: df -h | grep /dev/md/dsk/d0 I get the following result: /dev/md/dsk/d0
With df: df <- data.frame(value=abs(rnorm(100, 25, 5)), status=sample(0:1,100,replace=T)) df$value[sample(1:100,5)] <- NA I need to
Input: df -k Output: Filesystem kbytes used avail capacity Mounted on /dev/dsk/c0t0d0s0 10332220 443748
Given the matrix, df <- read.table(text=" X1 X2 X3 X4 X5 1 2 3
I have a data frame with a character column: df <- data.frame(var1 = c("aabbcdefg",
I used SimpleDateFormat: SimpleDateFormat df = new SimpleDateFormat(yyyy/MM/dd hh:mm:ss); value.adStartDate = df.parse(2011/11/11 11:11:11); I
All right, let's say I have the following plot. df = data.frame(date=c(rep(2008:2013, by=1)), value=c(303,407,538,696,881,1094))
Say I had the dataframe df <- data.frame('A' = c('a','a','a','a','b','b','b','b','b'), 'B' = c('y','y','z','z','y','y','y','z','z'), 'value'=c(1
df <- structure(list(ID = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
df <- data.frame(age=c(10,10,20,20,25,25,25),veg=c(0,1,0,1,1,0,1)) g=ggplot(data=df,aes(x=age,y=veg)) g=g+stat_summary(fun.y=mean,geom=point) Points reflect mean of veg at each age, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.