Awk Line 1 Syntax Error At Or Near Print
Contents |
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie [SOLVED] Need solution for awk: syntax error near line 1 ERROR User Name Remember Me? Password Linux awk syntax error near line 1 awk bailing out near line 1 - Newbie This Linux forum is for members that are new to Linux. Just
Awk Syntax Error At Source Line 1
starting out and have a question? If it is not in the man pages or the how-to's this is the place! Notices awk syntax error at source line 1 context is Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe awk syntax error near unexpected token (' to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need
Awk Bailing Out Near Line 1 Solaris
to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 10-11-2012, 03:56 AM #1 Vthimmap Member Registered: Oct 2012 Posts: 32 Rep: Need solution for awk: syntax error near line 1 ERROR Using awk in kron shell gives the error awk: syntax error near line 1 awk: bailing out near line 1 Kindly suggest the correct way of using sample script #echo " checks the null value in the first column" less PositPricesUSA.csv.cp | awk -F
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and awk syntax error policies of this site About Us Learn more about Stack Overflow the awk print company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes http://www.linuxquestions.org/questions/linux-newbie-8/need-solution-for-awk-syntax-error-near-line-1-error-4175431628/ a minute: Sign up AWK error - syntax error at or near grep up vote 1 down vote favorite I need to create a script to unbind/bind all usb in one linux machine. For this I need to run: lsusb -t wich returns: root@lsdg7sd-fc:~# lsusb -t /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci_hcd/10p, 12M |__ Port 4: Dev 2, If http://stackoverflow.com/questions/26739414/awk-error-syntax-error-at-or-near-grep 0, Class=vend., Driver=ftdi_sio, 12M |__ Port 6: Dev 4, If 0, Class=HID, Driver=usbhid, 1.5M |__ Port 6: Dev 4, If 1, Class=HID, Driver=usbhid, 1.5M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/10p, 480M Now, for this example I need to run: // disable the bus 1, port 1 echo '2-4' | tee /sys/bus/usb/drivers/usb/unbind // disable the bus 1, port 2 echo '2-6' | tee /sys/bus/usb/drivers/usb/unbind // enable the bus 1, port 1 echo '2-4' | tee /sys/bus/usb/drivers/usb/bind // enable the bus 1, port 2 echo '2-6' | tee /sys/bus/usb/drivers/usb/bind In order to achieve this by creating a script (I am very new to linux), I did the following: #!/bin/bash lsusb -t | awk '{ bus=""; if($1=="|__") print "Child USB Port: ",$3; else if ($1=="/:") { print $3; var= $(echo $3 | grep -o "[1-9]"); echo $var; } }' var=`echo "02.Port" | grep -o "[1-9]"`; echo $var; var=`echo "02.Port" | grep -o "[0-9]\{2\}"`; echo $var; I tried all the possible combinations in order to set var. I always get an error. awk: line 8: syntax error at or near grep Can a
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business http://askubuntu.com/questions/391482/syntax-error-in-awk-program Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Syntax error in awk program up vote 1 down vote favorite syntax error I want to check the method of IP-Assignment as in this question. I'm running it in bash on Ubuntu 12.04. My Problem is the function "get_con_id()" gives me "Syntax error" at the if-clause. The script is as following(unmodified from the answer in the given question): #!/bin/sh # get the connection id of the active connection get_con_id() { nm-tool | awk ' $1 == "-" { dev = $3 id = dev if (NF > 4 && match($0, awk syntax error "\\[(.*)\\]", a)) id = a[1] } /^ / && $1 == "State:" && $2 == "connected" { print id }' } # get the address type of the active connection nmcli con list id "$(get_con_id)" | awk ' $1 == "ipv4.method:" { if ($2 == "manual") print "static" else if ($2 == "auto") print "dynamic" else print "unknown" }' networking scripts awk share|improve this question edited Dec 16 '13 at 10:31 asked Dec 16 '13 at 9:13 PdXY 134 Exactly, it is just copied, but I can't comment the old thread without reputation. I copied it in a file named test.sh and ran ./test.sh. When I give an ID to the script and don't use the function it works. –PdXY Dec 16 '13 at 10:15 It look like it works, for me at least in a terminal. How are you executing this code? –minerz029 Dec 16 '13 at 10:23 Of course, the script is executable and the lower part works, if I replace nmcli con list id "$(get_con_id)" with nmcli con list id "