Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Gnu parallel and awk syntax quotes Post 302596931 by radoulov on Wednesday 8th of February 2012 04:43:22 PM
Old 02-08-2012
Try this:

Code:
... parallel awk \'NR == 1 \{ \
  print \$2, \$1, \$3, \$4, \$7, \$9, \$10, \$12 \
  next \
  \} \
  \$5 == \"ADD\" \{ \
    print \$2, \$1, \$3, \$4, \$7, \$9, \$10, \$12 \| \"sort -gk8\" \
    \}' OFS=\'\\t\' {1}_fileA.assoc \> {1}_fileA.assoc.ADD

Or just put your awk code in a script file and make your life easier Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Single v. double quotes in sed (GNU utilities for Win32 version)

I'm using sed for Windows at a WinNT command prompt. Wrapping the expressions with single quotes doesn't work. I have to use double quotes. Is this the norm for the Windows implementation? (2 Replies)
Discussion started by: daddydojo
2 Replies

2. UNIX for Dummies Questions & Answers

Parallel processing using AWK program

Hi All, could any expert tell me about writing a parallel processing program using AWK program is possible or not? Any example would be much appreciated... With Regards / Mysore Ganapati :confused: (5 Replies)
Discussion started by: ganapati
5 Replies

3. UNIX for Dummies Questions & Answers

| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax

Hello, I'm working on unix with grep (GNU grep) 2.5.1. I'm going through some of the newer regex syntax using Regular Expression Reference - Advanced Syntax a guide. ls -aLl /bin | grep "\(x\)" Which works, just highlights 'x' where ever, when ever. I'm trying to to get (?:) to work but... (4 Replies)
Discussion started by: MykC
4 Replies

4. Shell Programming and Scripting

quotes using awk

i want to print the statement below using awk,but i am unable to get the quotes ("22345",1,"Thank you"); How can i do this (5 Replies)
Discussion started by: tomjones
5 Replies

5. Shell Programming and Scripting

syntax issue with quotes in mysql command for a bash script

i'm trying to write a bash script that executes a mysql statement mysql -sN -e INSERT INTO "$database"."$tableprefix"users (var1, var2,var3) VALUES (123, '1','') i don't know where to put the quotes it doesnt work with this one: ` it seems i can only put double quotes around the... (0 Replies)
Discussion started by: vanessafan99
0 Replies

6. Shell Programming and Scripting

awk without quotes

I want to execute awk command without quotes. who am i | awk {'print $2'} above code should be something like: who am i | awk {print $2} Why such weird requirement? Im assigning command to a variable, hence i need to escape the quotes. e.g: x='who am i | awk {\'print $2\'}' I want... (11 Replies)
Discussion started by: Arun_Linux
11 Replies

7. Shell Programming and Scripting

Converting from Linux bash (GNU) to Solaris script syntax errors

Original script written on CentOS 6.3 with GNU bash 4.1.2 Destination system is Solaris 9 with GNU bash 2.05 (not changeable by me) I have a script written on the linux side but now we need to provide a version to another site that "doesn't like linux". I've been going through changing the ] or... (13 Replies)
Discussion started by: oly_r
13 Replies

8. Shell Programming and Scripting

awk - Print where value is in quotes

Hi All, I have input data like follows: "1234"|"ABC" "1234"|"CBA" "1222"|"ZZZ" I am trying to awk print all records where Col1 = "1234". Below is the code I have so far: Var1=1 Var2=1234 awk -F "|" "$ ${Var1} == "\"${Var2}\"" { print; }' inputfile However when the AWK... (2 Replies)
Discussion started by: RichZR
2 Replies

9. Shell Programming and Scripting

Using quotes in awk

Hello, i had a problem running a script , and after investigation found its all to do with the quotes: cat file1 line1 val1 val2 line2 val1 val2 line3 val1 val2 awk 'BEGIN {RS="\n\n"; FS="\n";} {print $1 $2}' file1 This gives me the wrong output: (5 Replies)
Discussion started by: andy391791
5 Replies

10. Shell Programming and Scripting

Python GNU parallel single command on multiple cores

Hello, I have a 4 core machine. Here is my initial script cd /work/ python script.py input.txt output.txt 1 2 3 This script runs for 1.5hrs. So I read across the web and figured out that you can use GNU parallel to submit multiple jobs using parallel. But I am not sure if I can run... (4 Replies)
Discussion started by: jacobs.smith
4 Replies
ALTER 
TYPE(7) PostgreSQL 9.2.7 Documentation ALTER TYPE(7) NAME
ALTER_TYPE - change the definition of a type SYNOPSIS
ALTER TYPE name action [, ... ] ALTER TYPE name OWNER TO new_owner ALTER TYPE name RENAME ATTRIBUTE attribute_name TO new_attribute_name [ CASCADE | RESTRICT ] ALTER TYPE name RENAME TO new_name ALTER TYPE name SET SCHEMA new_schema ALTER TYPE name ADD VALUE new_enum_value [ { BEFORE | AFTER } existing_enum_value ] where action is one of: ADD ATTRIBUTE attribute_name data_type [ COLLATE collation ] [ CASCADE | RESTRICT ] DROP ATTRIBUTE [ IF EXISTS ] attribute_name [ CASCADE | RESTRICT ] ALTER ATTRIBUTE attribute_name [ SET DATA ] TYPE data_type [ COLLATE collation ] [ CASCADE | RESTRICT ] DESCRIPTION
ALTER TYPE changes the definition of an existing type. There are several subforms: ADD ATTRIBUTE This form adds a new attribute to a composite type, using the same syntax as CREATE TYPE (CREATE_TYPE(7)). DROP ATTRIBUTE [ IF EXISTS ] This form drops an attribute from a composite type. If IF EXISTS is specified and the attribute does not exist, no error is thrown. In this case a notice is issued instead. SET DATA TYPE This form changes the type of an attribute of a composite type. OWNER This form changes the owner of the type. RENAME This form changes the name of the type or the name of an individual attribute of a composite type. SET SCHEMA This form moves the type into another schema. ADD VALUE [ BEFORE | AFTER ] This form adds a new value to an enum type. If the new value's place in the enum's ordering is not specified using BEFORE or AFTER, then the new item is placed at the end of the list of values. CASCADE Automatically propagate the operation to typed tables of the type being altered, and their descendants. RESTRICT Refuse the operation if the type being altered is the type of a typed table. This is the default. The ADD ATTRIBUTE, DROP ATTRIBUTE, and ALTER ATTRIBUTE actions can be combined into a list of multiple alterations to apply in parallel. For example, it is possible to add several attributes and/or alter the type of several attributes in a single command. You must own the type to use ALTER TYPE. To change the schema of a type, you must also have CREATE privilege on the new schema. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the type's schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the type. However, a superuser can alter ownership of any type anyway.) To add an attribute or alter an attribute type, you must also have USAGE privilege on the data type. PARAMETERS
name The name (possibly schema-qualified) of an existing type to alter. new_name The new name for the type. new_owner The user name of the new owner of the type. new_schema The new schema for the type. attribute_name The name of the attribute to add, alter, or drop. new_attribute_name The new name of the attribute to be renamed. data_type The data type of the attribute to add, or the new type of the attribute to alter. new_enum_value The new value to be added to an enum type's list of values. Like all enum literals, it needs to be quoted. existing_enum_value The existing enum value that the new value should be added immediately before or after in the enum type's sort ordering. Like all enum literals, it needs to be quoted. NOTES
ALTER TYPE ... ADD VALUE (the form that adds a new value to an enum type) cannot be executed inside a transaction block. Comparisons involving an added enum value will sometimes be slower than comparisons involving only original members of the enum type. This will usually only occur if BEFORE or AFTER is used to set the new value's sort position somewhere other than at the end of the list. However, sometimes it will happen even though the new value is added at the end (this occurs if the OID counter "wrapped around" since the original creation of the enum type). The slowdown is usually insignificant; but if it matters, optimal performance can be regained by dropping and recreating the enum type, or by dumping and reloading the database. EXAMPLES
To rename a data type: ALTER TYPE electronic_mail RENAME TO email; To change the owner of the type email to joe: ALTER TYPE email OWNER TO joe; To change the schema of the type email to customers: ALTER TYPE email SET SCHEMA customers; To add a new attribute to a type: ALTER TYPE compfoo ADD ATTRIBUTE f3 int; To add a new value to an enum type in a particular sort position: ALTER TYPE colors ADD VALUE 'orange' AFTER 'red'; COMPATIBILITY
The variants to add and drop attributes are part of the SQL standard; the other variants are PostgreSQL extensions. SEE ALSO
CREATE TYPE (CREATE_TYPE(7)), DROP TYPE (DROP_TYPE(7)) PostgreSQL 9.2.7 2014-02-17 ALTER TYPE(7)
All times are GMT -4. The time now is 11:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy