Sponsored Content
Top Forums Shell Programming and Scripting Deleting column from a flatfile with delimiter Post 302203219 by jaduks on Saturday 7th of June 2008 12:50:47 AM
Old 06-07-2008
Code:
$ cat filea
a#b#c
d#e#f
g#h#i

if you have to delete the 2nd column,

$ awk 'BEGIN{FS=OFS="#"}{$2=""}{print}' filea
a##c
d##f
g##i

or 

$ awk 'BEGIN{FS=OFS="#"}{$2="";gsub(FS "+",FS)}1' filea
a#c
d#f
g#i

//Jadu
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding a column in a flatfile

I have a file which is fixed width columns. This is an offset buffer - rather than space or tab delimited. There are upto about 8 columns and I need to get all of the column 5's values into another file. The problem is that because the delimiter is a space - and some fields are blank - the 5th... (3 Replies)
Discussion started by: peter.herlihy
3 Replies

2. Shell Programming and Scripting

Deleting a line from a flatfile using Shell Script

Hi All, Can Anyone please tell me,how can I delete a line from a file. I am reading the file line by line using whil loop and validating each line..Suppose in the middle i found a particular line is invalid,i need to delete that particular line. Can anyone please help. Thanks in advance,... (14 Replies)
Discussion started by: dinesh1985
14 Replies

3. Shell Programming and Scripting

Finding a flatfile & deleting first line

I have a small script where I want to see if a file exists & then delete the first line from it. I have code to help me find if the file exists, but I am unsure as to how to then take in the answer and remove the first line from the flatfile: This is what I have so far just to output if the... (3 Replies)
Discussion started by: fatalxkiss
3 Replies

4. Shell Programming and Scripting

rearrange the column names with comma as column delimiter

Hi, I am new to shell scripting, i have requirement can any one help me out in this regrads, in directory i have file like invoice1.txt, invoice2.txt in each file i have fixed number of columns, 62 in number but they are randomly arranged.like for first file invoice1.txt can have columns... (5 Replies)
Discussion started by: madhav62
5 Replies

5. Shell Programming and Scripting

Column to row with delimiter

Hi, i have data in a file f1.txt a b c d and i want to print the above column values in single line with a delimiter, say ',' The output should look like: a,b,c,d I could find rows to columns help online but not vice versa Thanks, -srinivas yelamanchili (4 Replies)
Discussion started by: ysrini
4 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Deleting all rows where the first column equals the second column

Hi, I have a tab delimited text file where the first two columns equal numbers. I want to delete all rows where the value in the first column equals the second column. How do I go about doing that? Thanks! Input: 1 1 ABC DEF 2 2 IJK LMN 1 2 ZYX OPW Output: 1 2 ZYX OPW (2 Replies)
Discussion started by: evelibertine
2 Replies

7. Shell Programming and Scripting

Remove the values from a certain column without deleting the Column name in a .CSV file

(14 Replies)
Discussion started by: dhruuv369
14 Replies

8. Shell Programming and Scripting

Ignore delimiter within a column

Hi, So I was trying this awk snippet awk -F, '$1 ~ /Match/' File This is my sample file output Name,Age,Nationality,Description Jack,20,American,Tall, caucasian, lean Mary,30,British,Short,white,slim I would expect expected Output to be, when a certain match is met say $1 is... (2 Replies)
Discussion started by: sidnow
2 Replies

9. Shell Programming and Scripting

Replace specific column delimiter

Hi All, I have a file with a pipe delimiter. I need to replace the delimiter with html tags. I managed to get all the delimiters replaced along with first and last but the requirement is that I need to change 7th delimiter with slight change. File1: ... (2 Replies)
Discussion started by: shash
2 Replies
autodia(3pm)						User Contributed Perl Documentation					      autodia(3pm)

NAME
autodia - a perl script using the Autodia modules to create UML Class Diagrams or documents. from code or other data sources. INTRODUCTION
AutoDia takes source files as input and using a handler parses them to create documentation through templates. The handlers allow AutoDia to parse any language by providing a handler and registering in in autodia.pm. The templates allow the output to be heavily customised from Dia XML to simple HTML and seperates the logic of the application from the presentation of the results. AutoDia is written in perl and defaults to the perl handler and file extension matching unless a language is specified using the -l switch. AutoDia requires Template Toolkit and Perl 5. Some handlers and templates may require additional software, for example the Java SDK for the java handler. AutoDia can use GraphViz to generate layout coordinates, and can produce di-graphs (notation for directional graphs) in dot (plain or canonical) and vcg, as well as Dia xml. Helpful information, links and news can be found at the autodia website - http://www.aarontrevena.co.uk/opensource/autodia/ USAGE
"autodia ([-i filename [-p path] ] or [-d directory [-r] ]) [options]" "autodia -i filename : use filename as input" "autodia -i 'filea fileb filec' : use filea, fileb and filec as input" "autodia -i filename -p .. : use ../filename as input file" "autodia -d directoryname : use *.pl/pm in directoryname as input files" "autodia -d 'foo bar quz' : use *pl/pm in directories foo, bar and quz as input files" "autodia -d directory -r : use *pl/pm in directory and its subdirectories as input files" "autodia -d directory -F : use files in directory but only one file per diagram" =item "autodia.pl -d directory -C : use files in directory but skip CVS directories" "autodia -o outfile.xml : use outfile.xml as output file (otherwise uses autodial.out.dia)" "autodia -O : output to stdout" "autodia -l language : parse source as language (ie: C) and look for appropriate filename extensions if also -d" "autodia -t templatefile : use templatefile as template (otherwise uses template.xml)" "autodia -l DBI -i "mysql:test:localhost" -U username -P password : use test database on localhost with username and password as username and password" "autodia -l Mason -i "/index.html" -p comp_root -G '$c' : use HTML::Mason to fetch /index.html from comp_root and show all components in reach. -G corresponds to allow_globals." "autodia -z : output via graphviz" "autodia -Z : output via springgraph" "autodia -v : output via VCG " "autodia -s skipfile : exclude files or packagenames matching those listed in file" c<autodia -D : ignore dependancies (ie do not process or display dependancies)> "autodia -K : do not display packages that are not part of input" "autodia -k : do not display superclasses that are not part of input" "autodia -H : show only Public/Visible methods" "autodia -m : show only Class methods" "autodia -M : do not show Class Methods" "autodia -a : show only Class Attributes" "autodia -A : do not show Class Attributes" "autodia -S : silent mode, no output to stdout except with -O" "autodia -h : display this help message" "autodia -V : display version and copyright message" perl v5.12.4 2011-05-23 autodia(3pm)
All times are GMT -4. The time now is 12:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy