Sponsored Content
Full Discussion: Awk: BEGIN: prints nothing
Top Forums Shell Programming and Scripting Awk: BEGIN: prints nothing Post 303008842 by genome on Wednesday 6th of December 2017 07:06:15 PM
Old 12-06-2017
Oh!

Sorry, didn't know or understand that.

Follow-up query:
How do I mention field separator in my code?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Another question on awk - Begin statement

Hi, I've a question on awk. In English I want to: (a) open a file, (b) search through the file for records where length of field15 > 20 characters and (c) print out some fields in the record. I've written the following and it works OK. The trouble is this will ALWAYS write out the column... (5 Replies)
Discussion started by: eff_cee
5 Replies

2. Shell Programming and Scripting

awk / grep / Prints all columns except the first one

I have the a file with the following data. File Content. 1249 snf06.3.0 sw version 1.1 code MD5 192F MD4 MD3 1248 sns06.3.0 sw version 1.1 code MD5 192F MD12 1250 sns06.3.0 sw version 1.1 code MD5 192F0\ MD8 1241 sns06.3.0 sw code MD5 19 1243 sn06.3.0 sw version 1.1 code MD5 19 12... (17 Replies)
Discussion started by: knijjar
17 Replies

3. Shell Programming and Scripting

Alias to awk BEGIN statement

I'd like to define an alias to awk's begin statement since I use awk with different delimiters all the time and it is tiresome to type awk '{OFS="\t";FS="\t"}{BLAH BLAH}' every time. The problem is that bash won't let me make an alias with an open quote, which is necessary for the BEGIN alias to... (3 Replies)
Discussion started by: baconbasher
3 Replies

4. Shell Programming and Scripting

awk getting stuck after BEGIN

I am beginner in awk awk 'BEGIN{for(i=1;(getline<"opnoise")>0;i++) arr=$1}{print arr}' In the above script, opnoise is a file, I am reading it into an array and then printing the value corresponding to index 20. Well this is not my real objective, but I have posted this example to describe... (1 Reply)
Discussion started by: akshaykr2
1 Replies

5. Shell Programming and Scripting

awk BEGIN problem

awk 'BEGIN { print "line one\nline two\nline three" }' After ./awktest.sh Usage: awk -f progfile file ... Usage: awk 'program' file ... POSIX options: GNU long options: -f progfile --file=progfile -F fs --field-separator=fs -v var=val ... (7 Replies)
Discussion started by: cola
7 Replies

6. Shell Programming and Scripting

awk system() prints extra 0 -- why?

Here's the command I'm running: # echo "hi" | awk '{etime = system("hostname") ; close("hostname") ; print etime""}' And here's the ouput: server.domain.tld 0 Why in the world is that second line, the one that's just "0", there? Many thanks in advance. (2 Replies)
Discussion started by: treesloth
2 Replies

7. Shell Programming and Scripting

BEGIN and END format in awk

I'm new to awk, trying to understand the basics. I'm trying to reset the counter everytime the program gets a new file to check. I figured in the BEGIN part it would work, but it doesn't. #!/bin/awk -f BEGIN {counter=0} { sum=0 for ( i=1; i<=NF;... (1 Reply)
Discussion started by: guitarist684
1 Replies

8. UNIX for Dummies Questions & Answers

awk search with begin

Hi, I have written below script to begin if the line has n #!/bin/ksh /usr/xpg4/bin/awk {/ n / 'BEGIN {X = "01"; X = "02"; X = "03"; X = "04"; X = "05"; X = "06"; X = "07"; X = "08"; X ="09"; X = "10"; X = "11"; X = "12"; };} NR > 1 {print $1 "\t" $5 "," X "," $6 " " $7}'} input.txt |... (9 Replies)
Discussion started by: stew
9 Replies

9. Shell Programming and Scripting

awk prints unwanted new lines

Hello, I need a little help with the following: I'm using AWK to read input from a comma-seperated value file, and only printing certain fields like so: awk -F "," '{print $1,$3,$6}' /list.csv | tail -1 Which outputs the following: server1 APPID OS I run into a problem... (8 Replies)
Discussion started by: LinuxRacr
8 Replies

10. Shell Programming and Scripting

awk prints only last line

data.txt: NEWTEXTS="frq=63,std=-0.00533584,time=Mar-21-(09:15:03)-2016,epoch=1458576903,avg=64.2059,212.698 frq=197,std=0.587585,time=Mar-21-(09:16:02)-2016,epoch=1458576962,avg=64.2059,483.756 frq=178,std=0.503514,time=Mar-21-(09:46:02)-2016,epoch=1458578762,avg=64.2059,500... (5 Replies)
Discussion started by: SkySmart
5 Replies
MYSQLND_MEMCACHE_GET_CONFIG(3)						 1					    MYSQLND_MEMCACHE_GET_CONFIG(3)

mysqlnd_memcache_get_config - Returns information about the plugin configuration

SYNOPSIS
array mysqlnd_memcache_get_config (mixed $connection) DESCRIPTION
This function returns an array of all mysqlnd_memcache related configuration information that is attached to the MySQL connection. This includes MySQL, the Memcache object provided via mysqlnd_memcache_set(3), and the table mapping configuration that was automatically col- lected from the MySQL Server. PARAMETERS
o $connection - A handle to a MySQL Server using one of the MySQL API extensions for PHP, which are PDO_MYSQL, mysqli or ext/mysql. RETURN VALUES
An array of mysqlnd_memcache configuration information on success, otherwise FALSE. The returned array has these elements: mysqlnd_memcache_get_config(3) array structure +--------------+---------------------------------------------------+ | Array Key | | | | | | | Description | | | | +--------------+---------------------------------------------------+ | memcached | | | | | | | Instance of Memcached associated to this MySQL | | | connection by mysqlnd_memcache_set. You can use | | | this to change settings of the memcache connec- | | | tion, or directly by querying the server on this | | | connection. | | | | | pattern | | | | | | | The PCRE regular expression used to match the | | | SQL query sent to the server. Queries matching | | | this pattern will be further analyzed to decide | | | whether the query can be intercepted and sent via | | | the memcache interface or whether the query is | | | sent using the general MySQL protocol to the | | | server. The pattern is either the default pattern | | | ( MYSQLND_MEMCACHE_DEFAULT_REGEXP) or it is set | | | via mysqlnd_memcache_set(3). | | | | | mappings | | | | | | | An associative array with a list of all config- | | | ured containers as they were discovered by this | | | plugin. The key for these elements is the name of | | | the container in the MySQL configuration. The | | | value is described below. The contents of this | | | field is created by querying the MySQL Server | | | during association to MySQL and a memcache con- | | | nection using mysqlnd_memcache_set. | | | | |mapping_query | | | | | | | An SQL query used during mysqlnd_memcache_set to | | | identify the available containers and mappings. | | | The result of that query is provided in the map- | | | pings element. | | | | +--------------+---------------------------------------------------+ Mapping entry structure +--------------+---------------------------------------------------+ | Array Key | | | | | | | Description | | | | +--------------+---------------------------------------------------+ | prefix | | | | | | | A prefix used while accessing data via memcache. | | | With the MySQL InnoDB Memcache Deamon plugin, | | | this usually begins with @@ and ends with a con- | | | figurable separator. This prefix is placed in | | | front of the key value while using the memcache | | | protocol. | | | | | schema_name | | | | | | | Name of the schema (database) which contains the | | | table being accessed. | | | | | table_name | | | | | | | Name of the table which contains the data acces- | | | sible via memcache protocol. | | | | |id_field_name | | | | | | | Name of the database field (column) with the id | | | used as key when accessing the table via mem- | | | cache. Often this is the database field having a | | | primary key. | | | | | separator | | | | | | | The separator used to split the different field | | | values. This is needed as memcache only provides | | | access to a single value while MySQL can map mul- | | | tiple columns to this value. | | | | | | Note | | | | | | | | | The separator, which can be set in | | | the MySQL Server configuration, | | | should not be part of any value | | | retrieved via memcache because | | | proper mapping can't be guaranteed. | | | | | fields | | | | | | | An array with the name of all fields available | | | for this mapping. | | | | +--------------+---------------------------------------------------+ EXAMPLES
Example #1 mysqlnd_memcache_get_config(3) example <?php $mysqli = new mysqli("host", "user", "passwd", "database"); $memc = new Memcached(); $memc->addServer("host", 11211); mysqlnd_memcache_set($mysqli, $memc); var_dump(mysqlnd_memcache_get_config($mysqli)); ?> The above example will output: array(4) { ["memcached"]=> object(Memcached)#2(0) { } ["pattern"]=> string(125) "/^s*SELECTs*(.+?)s*FROMs*`?([a-z0-9_]+)`?s*WHEREs*`?([a-z0-9_]+)`?s*=s*(?(?=["'])["']([^"']*)["']|([0-9e.]*))s*$/is" ["mappings"]=> array(1) { ["mymem_test"]=> array(6) { ["prefix"]=> string(13) "@@mymem_test." ["schema_name"]=> string(4) "test" ["table_name"]=> string(10) "mymem_test" ["id_field_name"]=> string(2) "id" ["separator"]=> string(1) "|" ["fields"]=> array(3) { [0]=> string(2) "f1" [1]=> string(2) "f2" [2]=> string(2) "f3" } } } ["mapping_query"]=> string(209) " SELECT c.name, CONCAT('@@', c.name, (SELECT value FROM innodb_memcache.config_options WHERE name = 'table_map_delimiter')) AS key_prefix, c.db_schema, c.db_table, c.key_columns, c.value_columns, (SELECT value FROM innodb_memcache.config_options WHERE name = 'separator') AS sep FROM innodb_memcache.containers c" } SEE ALSO
mysqlnd_memcache_set. PHP Documentation Group MYSQLND_MEMCACHE_GET_CONFIG(3)
All times are GMT -4. The time now is 01:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy