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 6717607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:52:20+00:00 2026-05-26T08:52:20+00:00

I want to process cron file with the time and cron entry into different

  • 0

I want to process cron file with the time and cron entry into different columns of DB.

cat root | awk '{print $1, $2, $3, $4, $5, $6}'

47 * * * * string=`find somefile`; echo $string > success.txt 2> err.txt

It is easy to awk the first 5 placeholders of the cron using awk. But how do I select the actual cron entry?
In the above example I want to select every thing from “string” to “$string”
I do also want to select the standard and error out file paths. i.e. success.txt and err.txt

update:

awk '{print $NF}'

The above works for the last variable, but the following does not to find the second-last.

awk '{print $NF-2}'
  • 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-05-26T08:52:20+00:00Added an answer on May 26, 2026 at 8:52 am

    A simple approach to get rid of the initial fields is to use cut:

    cut -d' ' --complement -f1-5
    

    I believe this requires the GNU version of cut, as the --complement flag is an extension.

    I’d use awk to split the rest into fields:

    awk '{ 
        outfile=$(NF-2)
        errfile=$NF
        for(n=NF; n>(NF-4); n--) { $n = ""}
        printf("command: %s\noutput: %s\nerror: %s\n", $0, outfile, errfile) 
    }'
    

    Note that this approach involves a few assumptions:

    • whitespace can be standardized to single spaces
    • both stdout and stderr are redirected
    • no spaces are present in the names for the output and error files
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to process each source code file after it has been preprocessed: myprocess
Say I have a data file that I want to process; I want to
i want to process a text file line by line. In the olden days
I want to process the comment input and write back into a TextView. I
I want to process incoming emails to an address and insert them into a
I want to process every element of a for-loop. Taking this code, why is
I want to process a medium to large number of text snippets using a
I have the following XML and I want to process it so that I
I have a c++ process, I want that process should always remain on foreground,
I have some data generated in MATLAB that I want to process using Perl.

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.