Sponsored Content
Full Discussion: Validating a file
Top Forums UNIX for Dummies Questions & Answers Validating a file Post 302469392 by dgeehot on Friday 5th of November 2010 07:02:20 PM
Old 11-05-2010
MySQL Tried this and nothing happened what did I do wrong

Thanks for the quick response, when I first rant this all my sample records went to the bad file. Then I realized, that there are 13 fields but only 12 pipes.

Some I eliminated 1 " [^|]*|" and re-ran and got the following, what portion does i field represent:

Code:
sed '/^[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|$/{w good_list d}' sample.txt > bad_list

and got the following error message:

Code:
sed: -e expression #1, char 0: unmatched `{'

---------- Post updated at 06:02 PM ---------- Previous update was at 05:04 PM ----------

I got fat fingers:

Code:
sed '
/^[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*$/{
w good_list
d
}
' < sample.var > bad_list

So can you give me a brief description on how it doe this

Last edited by Scott; 11-05-2010 at 08:08 PM.. Reason: Please use code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Validating inputs from a file

Hi, I have a file called inputs. Now that file has the values like this: 1 2 3 Now In my script called 'get.sh' I do this : exec < inputs read a b c d Now I know that there will not be any value in d. How can I check it. I need the exact condition for checking whether the variable has... (1 Reply)
Discussion started by: sendhilmani123
1 Replies

2. Shell Programming and Scripting

validating a file or directory

Hi there, im writing a script and trying the get the 2nd parameter and check it if its valid file or valid directory, Example: ./test -a quiz1 i need to check quiz1 ($2) if it matches any name of a file or directory. Thanks (3 Replies)
Discussion started by: new2Linux
3 Replies

3. Shell Programming and Scripting

validating a file based on conditions

i have a file in unix in which the records are like this aaa 123 233 aaa 234 222 aaa 242 222 bbb 122 111 bbb 122 123 ccc 124 222 In the output i want only the below records aaa ccc The validation logic is 1st column and 2nd column need to be considered if both columns values are... (8 Replies)
Discussion started by: trichyselva
8 Replies

4. Shell Programming and Scripting

validating a input file for numeric and character

i have a input file like this 001|rahim|bajaj|20090102 while reading the file i need to check whether the first column is a number second column is a name is there any methodology to check for the same thanks in advance (2 Replies)
Discussion started by: trichyselva
2 Replies

5. Shell Programming and Scripting

Shell script for validating fields in a file

Hi, I have not used Unix in a very long time and I am very rusty. I would appreciate any help I can get from the more experienced and experts in Shell script. I am reading one file at a time from a folder. The file is a flat file with no delimeters or carriage return. Col1 through col6 is... (5 Replies)
Discussion started by: asemota
5 Replies

6. Shell Programming and Scripting

Validating the file

Hello All, I have the following file. The first column is Type. Always the file will have one H and one T type in between all D type reocrds. Need todo some validations. H|ABCD D|TAB N0003107809CD2013-11-14|RYAN|FRY|7 DR|RICHMOND HILL|GA|32431|X|C95|000009999|000000001|TAB||C0001 D|TAB... (3 Replies)
Discussion started by: karumudi7
3 Replies

7. Shell Programming and Scripting

Validating XML file using XSD in UNIX

Hi, I have a xml file and a xsd file(xml schema file). Here using unix script i wanted to validate the xml file by referring to xsd file. The validation is in terms of Datatype,Field length and null values. If the data present in the xml file is not matching in terms of datatype,field length... (3 Replies)
Discussion started by: shree11
3 Replies

8. Shell Programming and Scripting

Csv file parsing and validating

Hi, I have basic knowledge on unix shell scripting(not an expert). My requirement is reading the csv file using the schema defined in the configuration file and if the condition is not mached then move the unmatched record to a error file and matched good records into other file. In brief: ... (43 Replies)
Discussion started by: shree11
43 Replies

9. Shell Programming and Scripting

Validating a file in ksh

Ladies and Gents, I need to be able to verify the file and validate the file format. Is there a way to verify this using ksh? Please forgive me, I'm very new to UNIX scripting. 12345_dbname_1_sqlname.sql 12345 - change number dbname - database name 1 - sequence sqlname - sql... (4 Replies)
Discussion started by: Philani
4 Replies
Imager::Preprocess(3pm) 				User Contributed Perl Documentation				   Imager::Preprocess(3pm)

NAME
Imager::Preprocess - simple preprocessor for handling multiple sample sizes SYNOPSIS
/* in the source: */ #code condition true to work with 8-bit samples ... code using preprocessor types/values ... #/code # process and make #line directives perl -MImager::Preprocess -epreprocess foo.im foo.c # process and no #line directives perl -MImager::Preprocess -epreprocess -l foo.im foo.c DESCRIPTION
This is a simple preprocessor that aims to reduce duplication of source code when implementing an algorithm both for 8-bit samples and double samples in Imager. Imager's "Makefile.PL" currently scans the MANIFEST for .im files and adds Makefile files to convert these to .c files. The beginning of a sample-independent section of code is preceded by: #code expression where expression should return true if processing should be done at 8-bits/sample. You can also use a #code block around a function definition to produce 8-bit and double sample versions of a function. In this case #code has no expression and you will need to use IM_SUFFIX() to produce different function names. The end of a sample-independent section of code is terminated by: #/code #code sections cannot be nested. #/code without a starting #code is an error. The following types and values are defined in a #code section: o IM_GPIX("im", "x", "y", &col) o IM_GLIN("im", "l", "r", "y", "colors") o IM_PPIX("im", "x", "y", &col) o IM_PLIN("im", "x", "y", "colors") o IM_GSAMP("im", "l", "r", "y", "samples", "chans", "chan_count") These correspond to the appropriate image function, eg. IM_GPIX() becomes i_gpix() or i_gpixf() as appropriate. o IM_ADAPT_COLORS("dest_channels", "src_channels", "colors", "count") Call i_adapt_colors() or i_adapt_fcolors(). o IM_FILL_COMBINE("fill") - retrieve the combine function from a fill object. o IM_FILL_FILLER("fill") - retrieve the fill_with_* function from a fill object. o IM_SAMPLE_MAX - maximum value for a sample o IM_SAMPLE_MAX2 - maximum value for a sample, squared o IM_SAMPLE_T - type of a sample (i_sample_t or i_fsample_t) o IM_COLOR - color type, either i_color or i_fcolor. o IM_WORK_T - working sample type, either int or double. o IM_Sf - format string for the sample type, "%d" or "%f". o IM_Wf - format string for the work type, "%d" or "%f". o IM_SUFFIX(identifier) - adds _8 or _double onto the end of identifier. o IM_EIGHT_BIT - this is a macro defined only in 8-bit/sample code. Other types, functions and values may be added in the future. AUTHOR
Tony Cook <tonyc@cpan.org> perl v5.14.2 2011-06-06 Imager::Preprocess(3pm)
All times are GMT -4. The time now is 03:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy