ArcGIS shapefile *.dbf file to ascii text

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ArcGIS shapefile *.dbf file to ascii text
# 1  
Old 01-28-2014
ArcGIS shapefile *.dbf file to ascii text

Okay, I search around and couldn't find what I needed, so here goes:

I have a series of ArcGIS point shapefiles. If I open them in Excel I can save as an Excel or text file and get a 2 column list:

1 | 2.34234
2 | 4.3425
3 | 6.32456

The problem is that I have hundreds of shapefiles. Obviously with so many shapfiles, using Excel is impractical to do for EACH one. I'm doing this so I can import only the values from certain points (pointID's) to create charts and graphs Excel. Each shapefile represents a date range, and each point value (from each shapefile) represents an elevation value.

So far I can use "strings" to convert it to an acsii, but that puts it into a single row with thousands of columns.

I can transpose using:

awk '
    for (i=1; i<=NF; i++)  {
        a[NR,i] = $i
NF>p { p = NF }
END {    
    for(j=1; j<=p; j++) {
        for(i=2; i<=NR; i++){
            str=str" "a[i,j];
        print str
}' file > file_out

The problem now is that it is a SINGLE column like this (because the source file was a single row - makes sense):


I want to get a 2 column list like what I can get from using Excel...

Any ideas?

# 2  
Old 01-28-2014
Looks like a one-liner...using the final output you show
awk '{FOO=$0;getline;print FOO, $0}' file-in-question

# 3  
Old 01-28-2014
I like paste for this kind of merges:

 $ cat aa
line one
line two
line three
 $ cat aa|paste - -
1       line one
2       line two
3       line three

This User Gave Thanks to migurus For This Post:
# 4  
Old 01-28-2014
Thanks guys!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert Hex to Ascii in a Ascii file

Hi All, I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting? Thanks in Advance (2 Replies)
Discussion started by: HemaV
2 Replies

2. Shell Programming and Scripting

Import ASCII 28 delimited text file

I have an ASCII 28 delimited text file(non-printable delimiter) with 4 columns along with the header.I need to open this text file in Excel or any other tool to view each column content. Please help.. Thanks (6 Replies)
Discussion started by: aneeta13
6 Replies

3. Shell Programming and Scripting

how to read dbf file in shell script and to convert dbf file usinf shell script

Hi all, I am new to shell scripting. I have dbf file and I need to convert it into csv file. OR, can i read the fields from a .dbf file and OR seprate the records in dbf file and put into .csv or txt. Actually in the .dbf files I am getting , the numbers of fields may vary in very record and... (6 Replies)
Discussion started by: gauara
6 Replies

4. Shell Programming and Scripting

ASCII Text formatting

Hi All, I have a requirement to create a formatted text. That is., I have a plain text composed to send it through an Email using mailx. I need to change the formatting of the text like BOLD, ITALIC, UNDERINED, COLOURED, INDENT etc., First of all, is it possible in UNIX? If yes, please let... (3 Replies)
Discussion started by: mohan_kumarcs
3 Replies

5. Programming

Reading a binary file in text or ASCII format

Hi All, Please suggest me how to read a binary file in text or ASCII format. thanks Nagendra (3 Replies)
Discussion started by: Nagendra
3 Replies

6. Shell Programming and Scripting

How to convert English text file to ASCII File?

file abc abc: English text I want to convert the above into file abc file: ascii text (1 Reply)
Discussion started by: laknar
1 Replies

7. Shell Programming and Scripting

mbox ascii mail text file ?

Hi, I am using "fetchmail" and "procmail" combination to trigger a job based on an input mail.Using fetchmail, incoming mail is downloaded from the mailserver to the local host.Once the mail is flushed,procmail starts execution and thereby triggers the application script. In-between... (3 Replies)
Discussion started by: DILEEP410
3 Replies

8. UNIX for Dummies Questions & Answers

Creating flat text file (ASCII)

Hi everybody. I need help and I hope someone is willing to help me out here. My wholesale company is currently moving to new software. The old software is running on a UNIX platform. We need to migrate data from the UNIX system, but our former software provider refuses to assist the data... (5 Replies)
Discussion started by: Wdonero
5 Replies

9. UNIX for Advanced & Expert Users

ascii to dbf HELP!

Hi, Does anyone know of an ascii to dbf converter for sco unix? Or any flavor of unix for that matter. Thanks! Georgio (1 Reply)
Discussion started by: gseyforth
1 Replies
Login or Register to Ask a Question