HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Persistant awk error
Operating System - Linux
1827857
Members
1654
Online
109969
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2006 07:21 PM
07-12-2006 07:21 PM
Persistant awk error
Hi
I have this two lines of awk code in some script awk '{FS="|"}
awk 'BEGIN { print " some text for test purposes " }'
Script only should print " some text for test purposes " ... that is only requrement on this script....
when I run this script I got an error like below
awk: Syntax error at source line 2
awk: Context is
awk >>> BEGIN <<<
awk: Missing }
awk: Bailing out at source line 2
And no I am not able to figure out what could be a possible reason for this error.
It would be help me a lot if someone know and have free time and will to write down what I should change in order to make this works.
Thanks
I have this two lines of awk code in some script awk '{FS="|"}
awk 'BEGIN { print " some text for test purposes " }'
Script only should print " some text for test purposes " ... that is only requrement on this script....
when I run this script I got an error like below
awk: Syntax error at source line 2
awk: Context is
awk >>> BEGIN <<<
awk: Missing }
awk: Bailing out at source line 2
And no I am not able to figure out what could be a possible reason for this error.
It would be help me a lot if someone know and have free time and will to write down what I should change in order to make this works.
Thanks
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2006 02:01 AM
07-13-2006 02:01 AM
Re: Persistant awk error
You dont need BEGIN and END declarations:
The script could be like this:
cat awk.script
{ print "Some text" }
echo | awk -f awk.script
Remember that awk spect to precess something (a file or command output), that is why the echo is inserted.
What I did not understand is the FS="|" declaration, anyway you can declare variables like this:
BEGIN { FS=":" }
{ print "Username",$1, "UID", $3 }
awk -f /tmp/awk.script /etc/passwd
The script could be like this:
cat awk.script
{ print "Some text" }
echo | awk -f awk.script
Remember that awk spect to precess something (a file or command output), that is why the echo is inserted.
What I did not understand is the FS="|" declaration, anyway you can declare variables like this:
BEGIN { FS=":" }
{ print "Username",$1, "UID", $3 }
awk -f /tmp/awk.script /etc/passwd
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP