validating data in columns and writing them to new file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting validating data in columns and writing them to new file
# 8  
Old 10-23-2012
Quote:
Originally Posted by DGPickett
Well, PERL, awk, sed, grep are all apps, but PERL is a full language (in which people shell out a lot!) not native to all UNIX systems. I like sed's moderately expanded regex:
Code:
sed '/^.\{30\}XT/!d' infile >outfile

coooll...some minor correctiSmilien...thanks DG
This User Gave Thanks to msabhi For This Post:
# 9  
Old 10-23-2012
It is nice if a solution is all of: terse, intuitively understandable, deconstructable and reusable. Smilie
This User Gave Thanks to DGPickett For This Post:
# 10  
Old 10-23-2012
Quote:
Originally Posted by msabhi
coooll...some minor correctiSmilien...thanks DG
Awesome thanks, It worked!!

---------- Post updated at 05:08 PM ---------- Previous update was at 05:07 PM ----------

Quote:
Originally Posted by DGPickett
It is nice if a solution is all of: terse, intuitively understandable, deconstructable and reusable. Smilie
Thx DG...coolll!!
# 11  
Old 10-23-2012
Sed is pretty close to vi and ksh/bash mode 'set -o vi' command recall and modify, so the skills are also transferrable. Of course, many of these tools can use regex.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Writing output to a file in columns

Hi I am trying to write output to a file in columns I have file in the follwoing: # cat file abc def # I am trying to write next output as like # cat file abc 123 def 345 # :mad: (6 Replies)
Discussion started by: Priya Amaresh
6 Replies

2. Shell Programming and Scripting

awk error - validating strings in columns

can someone please help me fix this command: somecommand.sh | awk -F"---" 'BEGIN{count=0} /P/ && /ERROR/ {if (($3 ~ /^P$/) && ($6 ~ /ERROR/)) {print; count++ }END { print count } ;}' basically, what i'm attempting to do here is print all the matching lines, then, at the end, print the total... (2 Replies)
Discussion started by: SkySmart
2 Replies

3. Shell Programming and Scripting

Writing input data in file

I am having an input file for eg. file.txt which contains pipe delimited rows file.txt: xx|yyy|zz|12|3|aaaaa|..... yy|zz|1|3|4|xxxxx|....... . . . i want the above file name to be transformed into another file with giving input from the user and replacing the corresponding fields based... (5 Replies)
Discussion started by: rohit_shinez
5 Replies

4. Shell Programming and Scripting

Comparing Columns and writing a new file

I have a table with one column File1.txt 1 2 3 4 5 6 7 8 9 10 Another table with two columns; This has got a subset of entries from File 1 but not unique because they have differing values in col 2. File2.txt 1 a 2 d 2 f 6 r 6 e (3 Replies)
Discussion started by: cs_novice
3 Replies

5. Shell Programming and Scripting

Problem in writing the data to a file in one row

Hi All I am reading data from the database and writing to temporary file in the below format. 1=XP|external_component|com.adp.meetingalertemail.processing.MeetingAlertEmail|EMAILALERTPUSH|32|4#XP |classpath|/usr/home/dfusr/lib/xalan.jar: /usr/home/dfusr/lib/xerces.jar: ... (2 Replies)
Discussion started by: rajeshorpu
2 Replies

6. Programming

writing binary/struct data to file

I am trying to write binary data to a file. My program below: #include <stdlib.h> #include <stdio.h> struct tinner { int j; int k; }; struct touter { int i; struct tinner *inner; }; int main() { struct touter data; data.i = 10; struct tinner... (4 Replies)
Discussion started by: radiatejava
4 Replies

7. Shell Programming and Scripting

AWK Help- Writing Data into a File

Hi All, I need to maintain a AUDIT file in system for every incoming and outgoing file. For this i am trying to append a record by using the AWK every time the file arriving. I have used the code as below. AWK '{print "FILENAME IS", $1,"DATE IS", $2}' >> AUDITFILE.txt $1 and $2 are global... (1 Reply)
Discussion started by: Raamc
1 Replies

8. UNIX for Dummies Questions & Answers

Validating XSL sheet data in Unix Data file

Dear All, Need your help. In my day to day activities I have to validate/search Excel Sheet data (eg.say Application No. 0066782345) data into the Unix environment file whether the same data is present in that file or not. There are hundreds of records coming in excel file and I am doing grep... (1 Reply)
Discussion started by: ravijunghare
1 Replies

9. Shell Programming and Scripting

validating data

I have a file like the following aaaaa00005bbbbb aaaaa00108bbbbb The code "00005" and "00108" need to be validated and the list of valid codes are stored in a database. While I loop through the file, should call a sql statement for every records to do the validation? or is... (1 Reply)
Discussion started by: joanneho
1 Replies
Login or Register to Ask a Question