Sponsored Content
Top Forums Shell Programming and Scripting Howto add a constant column to the text file Post 302676707 by elixir_sinari on Wednesday 25th of July 2012 04:26:22 AM
Old 07-25-2012
Or
Code:
path=$(pwd)
echo ${path##*/}

 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

2. Shell Programming and Scripting

Add new column in Text File

I have one text file which is result of bdf command that have 6 fields separated by space and I want to add one new column in the beginning which is the name of the server because I have to insert whole thing into oracle table consisting of 7 fields THis is not a complete list but it looks... (9 Replies)
Discussion started by: pareshan
9 Replies

3. Shell Programming and Scripting

how I can add a constant to a field without changing the file format

Hi, I need to edit a file Protein Data Bank (pdb) and then open that file with the program VMD but when I edit the file with awk, it changes pdb format and the VMD program can not read it. I need to subtract 34 to field 6 ($ 6). this is a pdb file : ATOM 918 N GLY B 103 -11.855 8.675... (8 Replies)
Discussion started by: bio_
8 Replies

4. UNIX for Dummies Questions & Answers

how to add a constant value to a column in a file using unix command

I have a file like this 1 chr1 3661579 3662579 2 chr1 4350395 4351395 3 chr1 4399322 4400322 4 chr1 4486494 4487494 5 chr1 4775807 4776807 6 chr1 4775807 4776807 7 chr1 4775807 4776807 8 chr1 4796973 4797973 9 chr1 4846774 4847774... (3 Replies)
Discussion started by: sunsnow86
3 Replies

5. UNIX for Dummies Questions & Answers

Add a new column to a tab delimited text file

I want to add a new column to a tab delimited text file. It will be the first column and it will just be 1's. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

6. Shell Programming and Scripting

Need to insert text(constant) at the beginning of file

I am very new to scripting and I know this request is simple but I am having no luck with it. I have a file a.dat with the following data in it. aa bb cc dd I need to run a script that will take each line of a.dat and put dsjc/ubin/ in front of each record, so the output looks like ... (2 Replies)
Discussion started by: jclanc8
2 Replies

7. UNIX for Dummies Questions & Answers

Add a column of 0's to a text file

Hi, I have a text file with many column (1,000,000+). I want to add a column of 0's as the third column. I tried: awk '{$3=0}1' input file > output file But it simply replaces the third column with 0's instead of adding a new column. How do I go about doing this? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies
grass-pg(1grass)						Grass User's Manual						  grass-pg(1grass)

NAME
grass-pg - PostgreSQL driver PostgreSQL driver PostgreSQL driver in GRASS The driver name is 'pg'. Creating a PostgreSQL database A new database is created with 'createdb', see the PostgreSQL manual for details. Connecting GRASS to PostgreSQL # example for connecting to a PostgreSQL server: db.connect driver=pg database="host=myserver.osgeo.org,dbname=mydb" # password is asked interactively if not specified: db.login user=myname [pass=secret] db.connect -p db.tables -p Supported SQL commands All SQL commands supported by PostgreSQL. It's not possible to use C-like escapes (with backslash like etc) within SQL syntax. Operators available in conditions All SQL operators supported by PostgreSQL. Adding an unique ID column Import vector module require an unique ID column which can be generated as follows in a PostgreSQL table: echo " ALTER TABLE mytable ADD ID integer; CREATE SEQUENCE mytable_seq; UPDATE mytabe SET ID = nextval('mytable_seq'); DROP SEQUENCE mytable_seq; " | db.execute Attribute Converters CSV import into PostgreSQL: h copy COPY t1 FROM 'filename' USING DELIMITERS ','; pg2xbase: DBF to PostgreSQL converter. Geometry import from PostgreSQL table v.in.db creates a new vector (points) map from a database table containing coordinates. See here for examples. PostGIS: PostgreSQL with vector geometry PostGIS: adds geographic object support to PostgreSQL. Example: Import from PostGIS In an existing PostGIS database, create the following table: CREATE TABLE test ( id serial NOT NULL, mytime timestamp DEFAULT now(), text varchar, wkb_geometry geometry, CONSTRAINT test_pkey PRIMARY KEY (id) ) WITHOUT OIDS; # insert value INSERT INTO test (text, wkb_geometry) VALUES ('Name',geometryFromText('POLYGON((600000 200000,650000 200000,650000 250000,600000 250000,600000 200000))',-1)); # register geometry column select AddGeometryColumn ('postgis', 'test', 'geometry', -1, 'GEOMETRY', 2); GRASS can import this PostGIS polygon map as follows: v.in.ogr dsn="PG:host=localhost dbname=postgis user=neteler" layer=test output=test type=boundary,centroid v.db.select test v.info -t test Geometry Converters PostGIS with shp2pgsql: shp2pgsql -D lakespy2 lakespy2 test > lakespy2.sql e00pg: E00 to PostGIS filter, see also v.in.e00. GDAL/OGR ogrinfo and ogr2ogr: GIS vector format converter and library, e.g. ArcInfo or SHAPE to PostGIS. ogr2ogr -f "PostgreSQL" shapefile ?? SEE ALSO
db.connect, db.execute, Database management in GRASS GIS, Help pages for database modules, SQL support in GRASS GIS PostgreSQL web site, pgAdmin graphical user interface Book: PostgreSQL: Introduction and Concepts by Bruce Momjian PostgreSQL Documentation PostgreSQL Technical Documentation GDAL/OGR PostgreSQL driver documentation MapServer Wiki Last changed: $Date: 2011-02-07 18:59:50 +0100 (Mon, 07 Feb 2011) $ Help Index GRASS 6.4.2 grass-pg(1grass)
All times are GMT -4. The time now is 10:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy