Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


awk: bailing out


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
awk: bailing out

If you see this:
Code:
awk: syntax error near line 1
awk: bailing out near line 1

Chances are you are working on Solaris and you are using standard awk.

If so, you need to use /usr/xpg4/bin/awk instead, which is POSIX awk (or nawk if that is not available).
These 2 Users Gave Thanks to Scrutinizer For This Post:
# 2  
In the few cases where that does not apply, you may have used a Microsoft editor such as Notepad and corrupted the unix text file with Microsoft line terminators, and then transferred the file to unix using a BINARY mode ftp file transfer which unlike an ASCII mode ftp file transfer does not convert the format. Often the quickest fix is to re-transfer the file using the correct mode.

In most versions of ftp giving the source file an MSDOS-type file extension of .txt will make the conversion automatic. In unix the MSDOS-type file extensions have no special meaning but are useful for general cross-platform recognition of the contents of a file.

A unix Text File has a line terminator of a single character line-feed.
A Microsoft MSDOS-type Text File has a line terminator of two characters carriage-return then line-feed. This is a historical design error in MSDOS.

In some early versons of Apple MACOS the line terminator for text files is the single character carriage-return. These text files are best converted prior to tranfer to unix. Current versions of Apple MACOS use the unix single character line-feed for a line terminator.


To remove the carriage-return characters with the unix tr (translate) command:
Code:
cat old_file.txt | tr -d '\r' > new_file.txt

Or if you system has the utilities, use dos2ux or dos2unix conversion utilities.

Last edited by methyl; 04-17-2012 at 06:46 PM.. Reason: assorted edits, including grammar and layout
These 3 Users Gave Thanks to methyl For This Post:
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Passing awk variable argument to a script which is being called inside awk
vivek d r
consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh...... Shell Programming and Scripting
2
Shell Programming and Scripting
HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?
shell_boy23
Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split...... Shell Programming and Scripting
6
Shell Programming and Scripting
AWK syntax /bailing script error when executing in UNIX
nandugo1
Hi I am trying to execute the following awk script in unix but getting the following error awk: syntax error near line 1 awk: bailing out near line 1 for i in `cat search` do grep -i -l $i *.sas | awk -v token=$i '{print token "\t" $0}' done Please let me know what could be the...... Shell Programming and Scripting
4
Shell Programming and Scripting
Awk and read bailing out
sol_nov
Hi All, Can some body help me in this to work #!/bin/ksh nof=`wc -l outFile_R.out | sed -e 's/*//g' ` no_of_lines=`expr $nof - 0` z=1 while ] do cat outFile_R.out | awk -v I="$z" 'NR==I { print $0 }' | read from_date to_date id echo "executing $from_date...... Shell Programming and Scripting
2
Shell Programming and Scripting
-awk: bailing out near line 1
kion
Hi I'm using cygwin and the script below works just fine under cygwin.. when i upload it on a unix server the script fails with the following errors -awk: syntax error near line 1 -awk: bailing out near line 1 any ideas why? thanx awk '($2 ~ /*/) { if ($4 < 40){ print...... Shell Programming and Scripting
3
Shell Programming and Scripting

Featured Tech Videos