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

  • Home
  • SEARCH
  • 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 8500607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:59:28+00:00 2026-06-11T00:59:28+00:00

I use two commands to scan for channels: awk ‘BEGIN{while( w_scan -c PL -x

  • 0

I use two commands to scan for channels:

awk 'BEGIN{while(" w_scan -c PL -x " | getline ) print >> "tmp" }'

awk 'BEGIN{while(" w_scan -I tmp -E 0 -t 3 -F " | getline) print >> "channels" }'

I want to do the same, but with one command. How to simplify to skip writing to tmp?

Thank you for your help.

EDIT:

I tried this command, but it does not work:

awk 'BEGIN { while (" w_scan -c PL -x " | getline ){split($0, tab, RS) system( " w_scan -I \047" tab[1] "\047 -E 0 -t 3 -F " ">>" "channels" )}}'

Result error -> enter link description here

EDIT-1

When I use this script does not work.

run.awk

BEGIN { 
  while (" w_scan -c PL -x " | getline ) {
    split($0, tab, RS) 
    system( " w_scan -I '\047'" tab[1] "'\047' -E 0 -t 3 -F >> channels" )
  }
}

Result error → enter link description here

When I use this script, it works well.

sh script

#!bin/bash
awk 'BEGIN{while(" w_scan -c PL -x " | getline ) print >> "tmp" }'
awk 'BEGIN{while(" w_scan -I tmp -E 0 -t 3 -F " | getline) print >> "channels" }'

Result –> enter link description here

  • 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-11T00:59:29+00:00Added an answer on June 11, 2026 at 12:59 am

    Just stick them both in the BEGIN block:

    awk '
      BEGIN {
        while(" w_scan -c PL -x " | getline ) print >> "tmp"
        while(" w_scan -I tmp -E 0 -t 3 -F " | getline) print >> "channels"
      }
    '
    

    If you want the whole thing on one line you can separate the commands with semicolon:

    awk 'BEGIN { while(" w_scan -c PL -x " | getline ) print >> "tmp"; while(" w_scan -I tmp -E 0 -t 3 -F " | getline) print >> "channels" }'
    

    Edit

    You’re accessing tmp in both loops, make sure it’s written before the second loop with close and sync:

    run.awk

    BEGIN {
      while(" w_scan -c PL -x " | getline ) 
        print >> "tmp"
      close("tmp")
      system("sync")
      while(" w_scan -I tmp -E 0 -t 3 -F " | getline) 
        print >> "channels"
    }
    

    Execute with:

    awk -f run.awk
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to enter integrate these two commands from cmd and use them
I want to use two different Spring web contexts , each have own contextConfig,
I want to use NAnt to execute sonar to scan my C# code. The
I use the following two commands to see my tables from binlogs. mysqlbinlog mysql-bin.000016
I'm trying to use Hadoop Streaming to run two commands such as gunzip |
In bash, we can use the && operator to execute two commands. For example:
How can I use something like this? :g/^$/kJ Here kJ are two commands, instead
If I use Dos command copy to concatenate two files: copy a1.txt + a2.txt
I use two different events for the callback to respond when the IndexedDB transaction
I use two Spinner in my App. One of them is initially disabled because

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.