How to use sed to insert character in the beginning of file path?
I need to manipulate one Database file on Solaris 11 in which contains more than 5000 lines of data file path like this:
,
In these path lines, the first part of path name contains number '/data28/ and three path group with different first part of name. I need to insert one path name: "bck1" in the beginning of each path name. After manipulation, the path name in the file should be like this:
I tried to use "v"i editor and "sed" to insert first part of path name. it can work on some lines and could not globally make change. I want to learn how to use "sed" to globally update the file path and deal with different number in path name and with different path name. Please help to provide your advice and command here. I will test and come back to report progress. Thanks for your time and help.
Hi, excuse me for my poor english.
My problem is that:
I have a File
i want to add to each line of that file two strings: one at the beginning of the line, one at the ending.
string1="abcd"
string2="efgh"
i want $string1 content $string2 for each line.
Is that possible? (3 Replies)
Hi,
how could you go about removing words that begin with a certain character.
assuming that this character is '-' I currently have
echo "-hello" | sed s/-/""/
which replaces the leading dash with nothing but I want to remove the whole word, even if there are multiple words beginning... (3 Replies)
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)
hi I am trying to use SED to replace the line matching a pattern using the command
sed 'pattern c\
new line
' <file1 >file 2
I got two questions
1. how do I insert a blank space at the beginning of new line?
2. how do I use this command to execute multiple command using the -e... (5 Replies)
Hi
I've been trying to search but couldn't quite get the answer I was looking for.
I have a a file that's like this
Time, 9/1/12
0:00, 1033
0:10, 1044
...
23:50, 1050
How do I make it so the file will be like this?
9/1/12, 0:00, 1033
9/1/12, 0:10, 1044
...
9/1/12, 23:50, 1050
I... (4 Replies)
Hi all,
I have a file like this
Q8N302
21-84
Q8N157
15-45
Q99996
167-201
202-251
269-318
I want to insert a character or space if the line starts with a number and I used the command
sed 's/^/#/'
But in the output file, when it inserts this character, first digit in the number is... (2 Replies)
Hi,,
I have the line below in a file:
$!VarSet |LFDSFN1| = '"E:\APC\Trials\20140705_427_Prototype Trial\Data\T4_20140705_Trial_Cycle_Data_13_T_Norm.txt" "VERSION=100 FILEEXT=\"*.txt\" FILEDESC=\"General Text\" "+""+"TITLE{SEARCH=NONE NAME=\"New Dataset\" LINE=1I want to write a script to change... (2 Replies)
Hi, I have been trying to see how i can insert a column in the beginning to my html table
This is how it looks
Name Age
Sid 32
John 33
Mary 34
I want to insert a column Job before Name column, so it looks like
Job Name Age
IT Sid 32
Doctor... (3 Replies)
Discussion started by: sidnow
3 Replies
LEARN ABOUT DEBIAN
grass-dbf
grass-dbf(1grass) Grass User's Manual grass-dbf(1grass)NAME
grass-dbf - DBF driver
DBF driver DBF driver in GRASS
Defining the DBF driver
The DBF driver is the default driver, in theory no user interaction is required. However, if the settings should be set back from a differ-
ent to the DBF driver, the following step is required:
# keep single quotes:
db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
db.connect -p
The dbf/ subdirectory in the mapset must exist or must be created by the user.
Creating a DBF table
Usually DBF tables are created by GRASS when generating a vector map with attributes (and using DBF as default attribute driver).
If a DBF table has to be created manually, db.execute can be used or a spreadsheet application. Also db.copy is sometimes useful as well as
db.in.ogr to import external tables.
Supported SQL commands by DBF driver
ALTER TABLE table ADD [COLUMN] columndef
ALTER TABLE table DROP COLUMN colname
CREATE TABLE table ( columndefs )
DROP TABLE table
SELECT columns FROM table
SELECT columns FROM table WHERE condition
SELECT columns FROM table ORDER BY column
DELETE FROM table
DELETE FROM table WHERE condition
INSERT INTO table VALUES (value1[,value2,...])
INSERT INTO table ( column1[,column2,...] ) VALUES (value1[,value2,...])
UPDATE table SET assignment1[,assignment2,...]
UPDATE table SET assignment1[,assignment2,...] WHERE condition
Operators available in conditions
"=" : equal
"<" : smaller than
"<=" : smaller/equal than
">" : larger than
">=" : larger/equal than
"<>" : not equal
"~" : Substring matching (non-standard SQL)
"%" : Substring matching (limited functionality)
Arithmetic expressions using constants and field values are allowed in condition clauses and in the RHS of assignments.
Usual precedence rules and bracketing (using '(' and ')') are supported.
Type conversion is performed if necessary (experimental).
Conditions allow boolean expressions using the AND, OR and NOT operators, with the usual precedence rules.
NULLs can be tested by 'colname IS NULL' in conditions. The negation is 'colname NOT NULL'.
Sorting: Empty fields in a character column are sorted to the end.
LIMITATIONS OF THE DBF DRIVER
The DBF driver supports only a few SQL statements since the DBF tables are intended for simple table storage. DBF column names are limited
to 10 characters (as defined in the DBF specifications). For example,
aggregate functions (sum, count, min, max,...) are not supported in SELECT clauses;
mathematic functions (sin, cos, exp, log,...) are not supported in expressions;
SQL query with IN are not supported.
ERROR MESSAGES
An error message such as:
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected NAME processing 'IN'..
indicates that an unsupported SQL statement (here, 'IN') was used. The only solution is to switch the DBMI backend to a real SQL engine
(SQLite, PostgreSQL, MySQL etc.). See SQL support in GRASS GIS.
An error message such as:
DBMI-DBF driver error:
SQL parser error: syntax error, unexpected DESC, expecting NAME processing 'DESC'
indicates that a column name corresponds to a reserved SQL word (here: 'DESC'). A different column name should be used. If this happens
during import with v.in.ogr, the cnames parameter can be used to assign different column names on the fly.
SEE ALSO
db.connect, SQL support in GRASS GIS
DBF Specifications (Shapelib)
Last changed: $Date: 2011-02-07 18:59:50 +0100 (Mon, 07 Feb 2011) $
Help Index
GRASS 6.4.2grass-dbf(1grass)