make it simple!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting make it simple!!!
# 1  
Old 08-21-2008
make it simple!!!

i am having following DML file i want to extract only highlighted area using sed or awk oneliner..
Quote:
decimal("¶") fuba_nbr; /* INTEGER NOT NULL*/
date("YYYY-MM-DD")("¶") xprn_dte = NULL(""); /* DATE*/
date("YYYY-MM-DD")("¶") effv_dte = NULL(""); /* DATE*/
date("YYYY-MM-DD")("¶") load_dte; /* DATE NOT NULL*/
string("¶", maximum_length=1) dbt_card_lnk_ind = NULL(""); /* CHAR("|")*/
string("¶", maximum_length=1) acct_rltps_ind = NULL(""); /* CHAR("|")*/
decimal("¶", maximum_length=6) br_nbr = 0; /* DECIMAL("|")*/
string("¶", maximum_length=9) ofcr_nbr = NULL(""); /* CHAR("|")*/
date("YYYY-MM-DD")("¶") last_od_dte = NULL(""); /* DATE*/
decimal("¶", maximum_length=17) curr_bal_amt = 0; /* DECIMAL("|")*/
string("¶", maximum_length=1) acct_type_cde = NULL(""); /* CHAR("|")*/
decimal("¶", maximum_length=8) pr_cde = 0; /* DECIMAL("|")*/
string("¶", maximum_length=20) cust_nme = NULL(""); /* CHAR("|")*/
string("¶", maximum_length=3) bnk_id = NULL(""); /* CHAR("|")*/
decimal("¶", maximum_length=4) city_cde = 0; /* DECIMAL("|")*/
decimal("¶", maximum_length=4) rgn_cde = 0; /* DECIMAL("|")*/
date("YYYY-MM-DD")("¶") last_dps_dte = NULL(""); /* DATE*/
decimal("¶", maximum_length=17) last_dps_amt = 0; /* DECIMAL("|")*/
i wrote the following sed command for this ..
it works fine but its too complex i guess.. can any one help me out to make it simpler..

Quote:
sed -e 's/\/\*[^*\/]*\*\///g;s/([^)]*)//g;s/=.*//g;s/;//g;s/^ *[^ ]* //' temp.dml


thanks in advance..
vidya..
# 2  
Old 08-21-2008
How about:

Code:
sed 's/.*) \([^ ;]*\).*/\1/g'

# 3  
Old 08-21-2008
oh great thanks..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to make it simple?

if ];then echo "ifconfig has output,and the output is " ifconfig -a fi this would run twice for "ifconfig -a" (3 Replies)
Discussion started by: yanglei_fage
3 Replies

2. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

3. Shell Programming and Scripting

How can I make my script simple?

Hi .. I am trying to print first row few columns and last row few column... I am doing like this... I want to do using single awk for file in *.xyz; do dt_end=$(awk 'END{print $2 "\t" $3 "\t" $4}' FS="," $file) dt_start=$(awk 'FNR == 1{print $1 " \t"$2 }' FS="," $file ) echo $dt_start... (6 Replies)
Discussion started by: nex_asp
6 Replies

4. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

5. Solaris

Trying to do a simple Make!

I am trying to do a make on below and have a question: http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz I am running Solaris 10 on x86. I have untarred the files above. I have gcc and gmake in /usr/sfw/bin BUT when I do >gmake in the directory with above files, it does not... (4 Replies)
Discussion started by: steve701
4 Replies

6. Shell Programming and Scripting

Script to make simple recurring ascii file edit

Hi, I have an ascii file with recurring lines (the file is 36mb so lots of lines) which look like this: -2.5 -66.324-68.138 935.2 1.953 -0.664 272.617 73.684 -2.428 269.998 0.000 Every 14 lines there is a blank line. I would like to, for each non-blank line,... (2 Replies)
Discussion started by: blueade7
2 Replies

7. UNIX for Dummies Questions & Answers

Difference between configure/make/make install.

Hi, While installation of apache on linux, we perform the below tasks. 1) Untar 2) configure 3) make 4) make install. I wanted to understand the difference and working of configure/make/make install. Can any one help me understanding this? Thanks in advance. (1 Reply)
Discussion started by: praveen_b744
1 Replies

8. Solaris

Gani Network Driver Won't Install - make: Fatal error: Don't know how to make targ...

I attached a README file that I will refer to. I successfully completed everything in the README file until step 4. # pwd /gani/gani-2.4.4 # ls COPYING Makefile.macros gem.c Makefile Makefile.sparc_gcc gem.h Makefile.amd64_gcc ... (1 Reply)
Discussion started by: Bradj47
1 Replies

9. Shell Programming and Scripting

Help to make the script simple

Hi All, I have a script which throws the output if condition matches. I run the cmd : # ldf Filesystem kbytes used avail capacity Mounted on /dev/dsk/c1t0d0s0 1984564 1375019 550009 72% / /dev/dsk/c1t0d0s3 5040814 2628410 2361996 53% /usr... (4 Replies)
Discussion started by: naw_deepak
4 Replies

10. UNIX for Dummies Questions & Answers

Simple make file questions....i think, thnx

Hello, I'm a noob when comes to make files.... My intentions for the use of my make file are not that of a usual compilation, etc. It is simply to copy some files from a RCS controlled area to a public area which has read rights only for a web page. My dilemma comes in the form of sub... (0 Replies)
Discussion started by: Roxydogg28
0 Replies
Login or Register to Ask a Question