06-17-2009
One more thing, panyan i need a scritp to remove the space before and after the operator like( +, -, ||, &&).
Ex :
Input file
apple + manago
mango && fresh + apple fresh || fruit
Desired output:
apple+manago
mango&&fresh+apple fresh||fruit
Note: betwee the desired operator space should be removed, between words do not remove space.
Thanks in advance,
Vasanth
-----Post Update-----
Dear rakeshawasthi ,
I have used cygwin bash shell.
I think your code, u r executing in KSH.
code used :
test=testfile
count=1
for i in `awk '{FS="[{}= \t]+";print $1}' $test`
do
a=`grep -w $i $test | awk '{FS="[{}= \t]+";for (i=2;i<=NF;i++)print $i}' | xargs`
if [[ $i == "rule" && $count -ne 1 ]];then
break
fi
echo $i $a
(( count = $count + 1 ))
done
Error message:
syntax error near unexpected token '$'do\r''
Thanks
vasanth
-----Post Update-----
Dear rakeshawasthi ,
I have used cygwin bash shell.
I think your code, u r executing in KSH.
code used :
test=testfile
count=1
for i in `awk '{FS="[{}= \t]+";print $1}' $test`
do
a=`grep -w $i $test | awk '{FS="[{}= \t]+";for (i=2;i<=NF;i++)print $i}' | xargs`
if [[ $i == "rule" && $count -ne 1 ]];then
break
fi
echo $i $a
(( count = $count + 1 ))
done
Error message:
syntax error near unexpected token '$'do\r''
Thanks
vasanth
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
PLZ Help us. I need to write a "while loop" script in borne shell to go into the /tmp directory every second and update me with the size of every file in the temp directory. My boss sprung this on me today and I have to have the script done by tomorrow. I can't loose my job, cause my wife and I... (1 Reply)
Discussion started by: scoobydoo
1 Replies
2. Shell Programming and Scripting
Here is what old matrix look like,
IDs X1 X2 Y1 Y2
10914061 -0.364613333 -0.362922333 0.001691 -0.450094667
10855062 0.845956333 0.860396667 0.014440333 1.483899333... (7 Replies)
Discussion started by: ssshen
7 Replies
3. Shell Programming and Scripting
I need to get the output in row wise for the repeated column data
Ex:
Input:
que = five
ans = 5
que = six
ans = 6
Required output:
que = five six
ans = 5 6
Any body can guide me?"""""" (2 Replies)
Discussion started by: vasanth_vadalur
2 Replies
4. Shell Programming and Scripting
hi all,
I have this file with some user data.
example:
$cat myfile.txt
FName|LName|Gender|Company|Branch|Bday|Salary|Age
aaaa|bbbb|male|cccc|dddd|19900814|15000|20|
eeee|asdg|male|gggg|ksgu|19911216|||
aara|bdbm|male|kkkk|acke|19931018||23|
asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies
5. Shell Programming and Scripting
Hi,
I have an excel sheet which has 100000 records. All these records are having 3 columns each with the last column as "Y" or "N". I would like to filter those records which has the value "Y". Can you please let me know how to proceed with that?
Thanks in advance.
-Sri
----------... (8 Replies)
Discussion started by: bhanusri83
8 Replies
6. Shell Programming and Scripting
Hi All ,
I have one file like below ,
Owner name = abu2-kxy-m29.hegen.app
Item_id = AX1981, special_id = *NULL*, version = 1
Created = 09/01/2010 12:56:56 (1283389016)
Enddate = 03/31/2011 00:00:00 (1301554800)
From the above file I need to get the output in the below format ,i need... (3 Replies)
Discussion started by: gnanasekar_beem
3 Replies
7. UNIX for Dummies Questions & Answers
Hi all!
I have a data set in this tab separated format : Label, Value1, Value2
An instance is "data.txt" :
0 1 1
-1 2 3
0 2 2
I would like to parse this data set and generate two files, one that has only data with the label 0 and the other with label -1, so my outputs should be, for... (1 Reply)
Discussion started by: gnat01
1 Replies
8. Shell Programming and Scripting
Hi folks,
Sorry for something I'm sure was answered already, I just could not find it in a search of the forums.
I am trying to build a script that eats a config file as:
cat file.cnf | ConProcess.shWhat I want to do inside the script is:
!#/usr/bin/bash
# captured piped cat into an... (6 Replies)
Discussion started by: Marc G
6 Replies
9. Shell Programming and Scripting
I have an awk script that gives the following output:
Average end-to-end transmission delay 2.7 to 5.7 is 0.635392 seconds
Average end-to-end transmission delay 2.1 to 5.1 is 0.66272 seconds
Average end-to-end transmission delay 2.1 to 5.1 is 0.691712 seconds
Average end-to-end transmission... (4 Replies)
Discussion started by: ENG_MOHD
4 Replies
10. Shell Programming and Scripting
Hello good afternoon to everyone.
I'm new to the forum and would like to request your help in handling data. I hope my English is clear.
I have a file (Dato01.txt) to contine the following structure.
# Col1 - Col2 - Col3 - Col4
Patricia started Jun 22 05:22:58
Carolina started Jun... (5 Replies)
Discussion started by: kelevra
5 Replies
LEARN ABOUT CENTOS
alter_extension
ALTER
EXTENSION(7) PostgreSQL 9.2.7 Documentation ALTER EXTENSION(7)
NAME
ALTER_EXTENSION - change the definition of an extension
SYNOPSIS
ALTER EXTENSION name UPDATE [ TO new_version ]
ALTER EXTENSION name SET SCHEMA new_schema
ALTER EXTENSION name ADD member_object
ALTER EXTENSION name DROP member_object
where member_object is:
AGGREGATE agg_name (agg_type [, ...] ) |
CAST (source_type AS target_type) |
COLLATION object_name |
CONVERSION object_name |
DOMAIN object_name |
FOREIGN DATA WRAPPER object_name |
FOREIGN TABLE object_name |
FUNCTION function_name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) |
OPERATOR operator_name (left_type, right_type) |
OPERATOR CLASS object_name USING index_method |
OPERATOR FAMILY object_name USING index_method |
[ PROCEDURAL ] LANGUAGE object_name |
SCHEMA object_name |
SEQUENCE object_name |
SERVER object_name |
TABLE object_name |
TEXT SEARCH CONFIGURATION object_name |
TEXT SEARCH DICTIONARY object_name |
TEXT SEARCH PARSER object_name |
TEXT SEARCH TEMPLATE object_name |
TYPE object_name |
VIEW object_name
DESCRIPTION
ALTER EXTENSION changes the definition of an installed extension. There are several subforms:
UPDATE
This form updates the extension to a newer version. The extension must supply a suitable update script (or series of scripts) that can
modify the currently-installed version into the requested version.
SET SCHEMA
This form moves the extension's objects into another schema. The extension has to be relocatable for this command to succeed.
ADD member_object
This form adds an existing object to the extension. This is mainly useful in extension update scripts. The object will subsequently be
treated as a member of the extension; notably, it can only be dropped by dropping the extension.
DROP member_object
This form removes a member object from the extension. This is mainly useful in extension update scripts. The object is not dropped,
only disassociated from the extension.
See Section 35.15, "Packaging Related Objects into an Extension", in the documentation for more information about these operations.
You must own the extension to use ALTER EXTENSION. The ADD/DROP forms require ownership of the added/dropped object as well.
PARAMETERS
name
The name of an installed extension.
new_version
The desired new version of the extension. This can be written as either an identifier or a string literal. If not specified, ALTER
EXTENSION UPDATE attempts to update to whatever is shown as the default version in the extension's control file.
new_schema
The new schema for the extension.
object_name, agg_name, function_name, operator_name
The name of an object to be added to or removed from the extension. Names of tables, aggregates, domains, foreign tables, functions,
operators, operator classes, operator families, sequences, text search objects, types, and views can be schema-qualified.
agg_type
An input data type on which the aggregate function operates. To reference a zero-argument aggregate function, write * in place of the
list of input data types.
source_type
The name of the source data type of the cast.
target_type
The name of the target data type of the cast.
argmode
The mode of a function argument: IN, OUT, INOUT, or VARIADIC. If omitted, the default is IN. Note that ALTER EXTENSION does not
actually pay any attention to OUT arguments, since only the input arguments are needed to determine the function's identity. So it is
sufficient to list the IN, INOUT, and VARIADIC arguments.
argname
The name of a function argument. Note that ALTER EXTENSION does not actually pay any attention to argument names, since only the
argument data types are needed to determine the function's identity.
argtype
The data type(s) of the function's arguments (optionally schema-qualified), if any.
left_type, right_type
The data type(s) of the operator's arguments (optionally schema-qualified). Write NONE for the missing argument of a prefix or postfix
operator.
PROCEDURAL
This is a noise word.
EXAMPLES
To update the hstore extension to version 2.0:
ALTER EXTENSION hstore UPDATE TO '2.0';
To change the schema of the hstore extension to utils:
ALTER EXTENSION hstore SET SCHEMA utils;
To add an existing function to the hstore extension:
ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);
COMPATIBILITY
ALTER EXTENSION is a PostgreSQL extension.
SEE ALSO
CREATE EXTENSION (CREATE_EXTENSION(7)), DROP EXTENSION (DROP_EXTENSION(7))
PostgreSQL 9.2.7 2014-02-17 ALTER EXTENSION(7)