awk script does not work when written as "one-liner"
In my quest to solve a bigger problem (See my previous post called "Create SQL DML insert statements from file using AWK or similar" - sorry, not allowed to post urls until I have > 5 posts) I'm trying to get my head round awk, but have some problem figuring out why the following script does work while the corresponding(?) one-liner does not?
Here is the script that works:
It splits a large file into smaller files based on blocks of text starting with " ABC_". And it does work.
However, If I try to enter this as a one-liner like this:
I get the following error:
Why? What is wrong with my one-liner?
A missing semi colon it was - thank you very much itkamaraj!
---------- Post updated at 11:00 AM ---------- Previous update was at 09:42 AM ----------
Well, it worked fine on my Linux-box, but as soon as I moved it over to my really old Solaris server (Solaris 10 8/07) I get
So, based on info found elswhere on this forum, I tried to use nawk instead:
But this gives me just empty files... Is there a workaround for my script when it comes to this limitation of 10 open files in Solaris? Can I tweak the script in some way?
---------- Post updated at 11:53 AM ---------- Previous update was at 11:00 AM ----------
I got past the number of open files limitation by using the POSIX compliant awk instead of the awk that is in the solaris standard path (/usr/bin/awk):
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hello, :)
I've an issue with the creation of a directory, All work without it :mad: So, below, my scripts with the debug output :
#!/bin/bash
# PATHS
HOME_BACKUP="/home/backup"
HOME_SCRIPT="/home/scripts/test/backup_server"
TARGET="/var/www"
# DATE
DATE_Ymd=$(date +%Y-%m-%d)
#... (1 Reply)
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi all,
I have an gawk script to get user's input, So I use
getline name < "-" (or getline name < "/dev/stdin") in my script
They both work fine when my script deals with files. But it is broken for pipes.
When I try "some command | my awk script", the variable name just gets an empty... (17 Replies)
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)