03-02-2011
You can use the field number as well. In this case there are total 9 fields separated by space.
This would give you the 9th ( last) field. Try using the commands below :
Quote:
awk '{print $0}'
awk '{print $1}'
awk '{print $2}'
awk '{print $3}'
and so on & see what you get.
Alternatively , you can use CUT command as well.
( All the chaaracters starting from 47th index. )
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am getting different output for grep depending which directory I am in.
The following is a transcript of my session, I am using egrep but have also used grep -E. The directory names have been changed for security:
$pwd
/dir1/dir2/dir3/dir4
$echo 000000 |egrep -v
$echo $?
1
$cd ..... (10 Replies)
Discussion started by: Bab00shka
10 Replies
2. Shell Programming and Scripting
hi,
why the following is giving entire /etc/passwd file as output
even when it does not contain ^ or $ .
grep ' ' /etc/passwd
whereas the following is not giving any output
grep ' ^$ ' /etc/passwd (3 Replies)
Discussion started by: useless79
3 Replies
3. UNIX for Dummies Questions & Answers
I'm using this command to get a recursive grep
find . -name *.i -exec grep 'blah blah' {} \; -exec ls {} \;
now I would like to obtain just the list of the files and not also the line of the file.
How should I change the syntax?
thank you, (5 Replies)
Discussion started by: f_o_555
5 Replies
4. Shell Programming and Scripting
How can I perform a grep and it will give me a contain word (maintenance) instead of a string or the whole line of info.
grep with exclusive output?
or is there a CONTAIN with IF statement ?
I have a file call yast2_vhost.conf and it contain multiple entries call
maintenance.html... (2 Replies)
Discussion started by: yoom@hostwebase
2 Replies
5. UNIX for Dummies Questions & Answers
Hello,
I have a list of stings that I'm using with grep to determine which files contain the strings. Here's what I have now:
list of strings in a file (list.txt):
/directory/direc tory/file.jsp
/dire ctory/directory/direct ory/file.jsp
grep I'm doing to find files that contain the... (4 Replies)
Discussion started by: upstate_boy
4 Replies
6. Shell Programming and Scripting
hi
i am running grep -c on a bunch of files some of which may be non existent. The output i get is in the same order as the files grep checks and this is what i want as i need to copy the output to a spreadsheet. However when i tried to pipe the output to sed to strip away the filenames and just... (5 Replies)
Discussion started by: chronics
5 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
Here is my problem:
I'm testing a login script for our mac Machines. This script output's in a csv file.
The login script looks like this:
echo "${computername}|${data1}|${data2}|${data3}" >> file.csv
The csv file looks like this:
Computername1|data1|data2|data3... (4 Replies)
Discussion started by: mattiasvdm
4 Replies
8. Shell Programming and Scripting
currently I have process from a raw file to this stage
ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID")
ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID")
ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies
9. UNIX for Dummies Questions & Answers
Hi guys -
I am trying to have a certain file display information horizontally divided by a pipe.
for example
file name: foo.dat has information like this:
name1
name2
name3
namenamename4
namene5
I would like it to display like this:
name1|name2|name3|namenamename4|namene5
... (6 Replies)
Discussion started by: DallasT
6 Replies
10. UNIX for Beginners Questions & Answers
Hi.
I have a command line that will generate exif data from .jpg files...
So to get the Camera Model I use:
find -iname "*.jpg" -print0 | xargs -0 exiftool -a | grep "Camera Model"
But I want the file name AND the camera model... How to I get the grep to give me TWO bits of information from... (2 Replies)
Discussion started by: TuftyDave
2 Replies
LEARN ABOUT DEBIAN
dbf2mysql
DBF2MYSQL(1) General Commands Manual DBF2MYSQL(1)
NAME
dbf2mysql, mysql2dbf - convert between xBase and MySQL databases
SYNOPSIS
dbf2mysql [-v[v]] [-f] [-u|-l] [-n] [-o field[,field]] [-e conversion-file] [-s old-name=new-name[,old-name=new-name]] [-i field[,field]]
[-d database] [-t table] [-c[c]] [-p primary] [-h host] [-F] [-q] [-r] [-x] [-P password] [-U user] dbf-file
mysql2dbf [-v[v]] [-u|-l] -d database -t table [-h host] [-q query] [-P password] [-U user] dbf-file
DESCRIPTION
dbf2mysql takes an xBase file and sends queries to an MySQL server to insert it into an MySQL table.
mysql2dbf dumps a MySQL table to a dbf file.
OPTIONS
-v Produce some status output.
-vv More verbose.
-vvv Even more verbose: produce a progress report.
-f Translate all field names in the xBase file to lowercase.
-u Translate all text in the xBase file to uppercase.
-l Translate all text in the xBase file to lowercase.
-n Allow NULL fields: 'NOT NULL' will be not added in table creation statement.
-o field[,field[,...]]
List fields to insert into MySQL database. Primary use is to ease import of complex dbf files where we want only few fields. NOTE:
-o is processed before substitution (-s), so you have to use dbf field names here.
-e conversion-file
Specify file for CHAR fields conversion. File format is: 1st line: number of characters to convert (number of lines). Further
lines: <char_to_convert> <char_after_conversion>.
-s old-name=new-name[,old-name=new-name[,...]]
Takes a list of field name/new field name pairs. Primary use is to avoid conflicts between field names and MySQL reserved keywords.
When the new field name is empty, the field is skipped in both the CREATE clause and the INSERT clauses, i.e. it will not be present
in the MySQL table. For example:
-s ORDER=HORDER,REMARKS=,STAT1=STATUS1
-i field[,field[,...]]
List fields to be indexed. MySQL field names should be used here.
-d database
Select the database to insert into. Default is 'test'.
-t table
Select the table to insert into. Default is 'test'.
-c[c] Create table if one doesn't exist already. If the table already exists, drop it and build a new one. The default is to insert all
data into the named table. If -cc is specified, no records will be inserted.
-p primary
Select the primary key. You have to give the exact field name.
-h host
Select the host to insert into. Untested.
-F Fixed length records. (By default CHAR is saved as VARCHAR.)
-q dbf2mysql: "Quick" mode. Inserts data via temporary file using 'LOAD DATA INFILE' MySQL statement. This increased insertion speed
on my PC 2-2.5 times. Also note that during whole 'LOAD DATA' affected table is locked.
mysql2dbf: Specify custom query to use.
-r Trim trailing and leading whitespace from CHAR type fields data.
-x Start each table with _rec and _timestamp fields.
-P password
Specify password on the MySQL server.
-U user
Specify user on the MySQL server.
BUGS
mysql2dbf can't write MEMO files at this time.
Possibly incorrect field lengths for REAL numbers.
AUTHORS
Originally written by Maarten Boekhold <boekhold@cindy.et.tudelft.nl>, Oct 1995.
Patched for MySQL by Michael Widenius <monty@analytikerna.se>, 3 Nov 1996.
Manual page written for Debian GNU/Linux from README by Heiko Schlittermann <heiko@lotte.sax.de>, Aug 1997; updated by Matej Vela
<vela@debian.org>, Nov 2001.
COPYRIGHT
Use this piece of software as you want, modify it to suit your needs, but please leave my name in place ok? :)
DISCLAIMER
The authors do not accept any responsibility for possible damage you get as result of using this program.
Debian Project 2001-11-18 DBF2MYSQL(1)