Sponsored Content
Top Forums UNIX for Advanced & Expert Users How to split large file with different record delimiter? Post 302990710 by Ravi.K on Tuesday 31st of January 2017 04:31:56 AM
Old 01-31-2017
Quote:
Originally Posted by Scrutinizer
Could you post a sample of your input file?
Here is format of the file.

| - field delimiter
|##| - record delimiter

Code:
100|COL1|COL2|COL3|##|200|COL1|COL2|COL3|##|300|COL1|COL2|COL3|##|400|COL1|COL2|COL3|##|500|COL1|COL2|COL3

Thanks



Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 01-31-2017 at 06:22 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split A Large File

Hi, I have a large file(csv format) that I need to split into 2 files. The file looks something like Original_file.txt first name, family name, address a, b, c, d, e, f, and so on for over 100,00 lines I need to create two files from this one file. The condition is i need to ensure... (4 Replies)
Discussion started by: nbvcxzdz
4 Replies

2. Shell Programming and Scripting

Pivot variable record length file and change delimiter

Hi experts. I got a file (500mb max) and need to pivot it (loading into ORCL) and change BLANK delimiter to PIPE |. Sometimes there are multipel BLANKS (as a particular value may be BLANK, or simply two BLANKS instead of one BLANK). thanks for your input! Cheers, Layout... (3 Replies)
Discussion started by: thomasr
3 Replies

3. Shell Programming and Scripting

Split Large File

HI, i've to split a large file which inputs seems like : Input file name_file.txt 00001|AAAA|MAIL|DATEOFBIRTHT|....... 00001|AAAA|MAIL|DATEOFBIRTHT|....... 00002|BBBB|MAIL|DATEOFBIRTHT|....... 00002|BBBB|MAIL|DATEOFBIRTHT|....... 00003|CCCC|MAIL|DATEOFBIRTHT|.......... (1 Reply)
Discussion started by: AMARA
1 Replies

4. Shell Programming and Scripting

split record based on delimiter

Hi, My inputfile contains field separaer is ^. 12^inms^ 13^fakdks^ssk^s3 23^avsd^ 13^fakdks^ssk^a4 I wanted to print only 2 delimiter occurence i.e 12^inms^ 23^avsd^ (4 Replies)
Discussion started by: Jairaj
4 Replies

5. Shell Programming and Scripting

How to delete 1 record in large file!

Hi All, I'm a newbie here, I'm just wondering on how to delete a single record in a large file in unix. ex. file1.txt is 1000 records nikki1 nikki2 nikki3 what i want to do is delete the nikki2 record in file1.txt. is it possible? Please advise, Thanks, (3 Replies)
Discussion started by: nikki1200
3 Replies

6. Shell Programming and Scripting

split file by delimiter with csplit

Hello, I want to split a big file into smaller ones with certain "counts". I am aware this type of job has been asked quite often, but I posted again when I came to csplit, which may be simpler to solve the problem. Input file (fasta format): >seq1 agtcagtc agtcagtc ag >seq2 agtcagtcagtc... (8 Replies)
Discussion started by: yifangt
8 Replies

7. Shell Programming and Scripting

Split file into multiple files using delimiter

Hi, I have a file which has many URLs delimited by space. Now i want them to move to separate files each one holding 10 URLs per file. http://3276.e-printphoto.co.uk/guardian http://abdera.apache.org/ http://abdera.apache.org/docs/api/index.html I have used the below code to arrange... (6 Replies)
Discussion started by: vel4ever
6 Replies

8. Shell Programming and Scripting

Split a large file in n records and skip a particular record

Hello All, I have a large file, more than 50,000 lines, and I want to split it in even 5000 records. Which I can do using sed '1d;$d;' <filename> | awk 'NR%5000==1{x="F"++i;}{print > x}'Now I need to add one more condition that is not to break the file at 5000th record if the 5000th record... (20 Replies)
Discussion started by: ibmtech
20 Replies

9. Shell Programming and Scripting

How to target certain delimiter to split text file?

Hi, all. I have an input file. I would like to generate 3 types of output files. Input: LG10_PM_map_19_LEnd_1000560 LG10_PM_map_6-1_27101856 LG10_PM_map_71_REnd_20597718 LG12_PM_map_5_chr_118419232 LG13_PM_map_121_24341052 LG14_PM_1a_456799 LG1_MM_scf_5a_opt_abc_9029993 ... (5 Replies)
Discussion started by: huiyee1
5 Replies

10. Shell Programming and Scripting

How to check record delimiter of a file ?

My requirment is for every record of a particular file I've to check for a record delimeter (e.g. "\n") and if any row doesn't have "\n" then report it in error file . Please suggest me to go through this. (4 Replies)
Discussion started by: manab86
4 Replies
funsky(1)							SAORD Documentation							 funsky(1)

NAME
funsky - convert between image and sky coordinates SYNOPSIS
funsky iname[ext] # RA,Dec (deg) or image pix from stdin funsky iname[ext] [lname] # RA, Dec (deg) or image pix from list funsky iname[ext] [col1] [col2] # named cols:units from stdin funsky iname[ext] [lname] [col1] [col2] # named cols:units from list OPTIONS
-d # always use integer tlmin conversion (as ds9 does) -r # convert x,y to RA,Dec (default: convert RA,Dec to x,y) -o # include offset from the nominal target position (in arcsec) -v # display input values also (default: display output only) -T # output display in rdb format (w/header,tab delimiters) DESCRIPTION
Funsky converts input sky coordinates (RA, Dec) to image coordinates (or vice versa) using the WCS information contained in the specified FITS file. Several calling sequences are supported in order to make it easy to specify coordinate positions in different ways. The first required argument is always the input FITS file (or extension) containing the WCS information in an extension header. Note that the data from this file is not used. By default, the program converts input RA and Dec values to X and Y using this WCS information. If the WCS is associated with a FITS image, then the X,Y values are image values. If the WCS is associated with a binary table, then the X, Y val- ues are physical values. To convert X,Y to RA and Dec, use the -r (reverse) switch. If no other command arguments are supplied, then the input positions are read from the standard input. Each line is assumed to contain a single coordinate position consisting of an RA in hours (or X in pixels) followed by a Dec in degrees (or Y in pixels). The usual delim- iters are supported (spaces, commas, tabs). For example: # read from stdin, default column names and units [sh] funsky snr.ev 22.982695 58.606523 # input RA (hrs), Dec(deg) 510.00 510.00 22.982127 58.607634 # input 512.00 510.50 22.981700 58.614301 # input 513.50 513.50 ^D # end of input If a second argument is supplied, this argument is assumed to be a file containing RA (X) and Dec (Y) positions. The file can either be an ASCII table or a FITS binary table. The order of columns is unimportant, if the table has a column header. In this case, the names of the columns must be one of "RA", "DEC", or "X", "Y" for sky to image and image to sky conversions, respectively. If the table has no header, then once again, RA (X) is assumed to first, followed by DEC (Y). For example: # read from file, default column names and units [sh] cat hd.in RA DEC --------- --------- 22.982695 58.606523 22.982127 58.607634 22.981700 58.614301 [sh] funsky snr.ev hd.in 510.00 510.00 512.00 510.50 513.50 513.50 If three arguments are supplied, then the input positions again are read from the standard input. Each line is assumed to contain a single coordinate position consisting of an RA (or X in pixels) followed by a Dec (or Y in pixels), with the usual delimiters supported. However, the second and third arguments now specify the column names and/or sky units using a colon-delimited syntax: [colname]:[h|d|r] If the colname is omitted, the names default to "RA", "DEC", "X", "Y", "COL1", or "COL2" as above. If the units are omitted, the default is hours for RA and degrees for Dec. When the -r switch is used (convert from image to sky) the units are applied to the output instead of the input. The following examples will serve to illustrate the options: # read from stdin, specifying column names (def. units: hours, degrees) [sh] cat hd.in MYRA MYDEC --------- --------- 22.982695 58.606523 22.982127 58.607634 22.981700 58.614301 [sh] funsky snr.ev MYRA MYDEC < hd.in 510.00 510.00 512.00 510.50 513.50 513.50 # read from stdin, specifying column names and units [sh] cat dd.in MYRA MYDEC --------- --------- 344.740432 58.606523 344.731900 58.607634 344.725500 58.614301 [sh] funsky snr.ev MYRA:d MYDEC:d < dd.in 510.00 510.00 512.00 510.50 513.50 513.50 # read stdin, convert image to sky, specifying output sky units [sh] cat im.in 510.00 510.00 512.00 510.50 513.50 513.50 [sh] cat im.in | funsky -r snr.ev :d :d 344.740432 58.606523 344.731900 58.607634 344.725500 58.614301 Finally, four command arguments specify both and input file and column names and/or units: [sh] cat dd.in MYRA MYDEC --------- --------- 344.740432 58.606523 344.731900 58.607634 344.725500 58.614301 [sh] funsky snr.ev dd.in MYRA:d MYDEC:d 510.00 510.00 512.00 510.50 513.50 513.50 # read file, convert image to sky, specifying output sky units [sh] cat im.in 510.00 510.00 512.00 510.50 513.50 513.50 [sh] funsky -r snr.ev im.in :d :d 344.740432 58.606523 344.731900 58.607634 344.725500 58.614301 By default, the output of funsky consists only of the converted coordinate position(s), one per output line. This makes parsing in shell scripts easy. Use the -v (verbose) switch to specify that the input coordinates should be pre-pended to each line. For example: [sh] cat dd.in MYRA MYDEC --------- --------- 344.740432 58.606523 344.731900 58.607634 344.725500 58.614301 [sh] funsky snr.ev dd.in MYRA:d MYDEC:d 510.00 510.00 512.00 510.50 513.50 513.50 [sh] funsky -v snr.ev dd.in MYRA:d MYDEC:d 344.740432 58.606523 510.00 510.00 344.731900 58.607634 512.00 510.50 344.725500 58.614301 513.50 513.50 In addition, a full starbase table can be output using the -T (table) switch. This switch can be used with or without the -v switch. If the -T and -v are both specified, then a descriptive header parameters are output before the table (mainly to remind you of the sky units): # output table in non-verbose mode [sh] funsky -T snr.ev dd.in MYRA:d MYDEC:d X Y ------------ ------------ 510.00 510.00 512.00 510.50 513.50 513.50 # output table in verbose mode [sh] funsky -T -v snr.ev dd.in MYRA:d MYDEC:d # IFILE = /Users/eric/data/snr.ev # ICOL1 = MYRA # ICOL2 = MYDEC # IUNITS1 = d # IUNITS2 = d # OCOL1 = X # OCOL2 = Y MYRA MYDEC X Y ------------ ------------ ------------ ------------ 344.740432 58.606523 510.00 510.00 344.731900 58.607634 512.00 510.50 344.725500 58.614301 513.50 513.50 Finally, the -d (ds9) switch mimicks ds9's use of integer TLMIN and TLMAX values for all coordinate transformations. FITS conventions seem to call for use of floating point TLMIN and TLMAX when the data are floats. This convention is followed by funsky but results in a small discrepancy with ds9's converted values for floating point data. We will remedy this conflict in the future, maybe. SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 funsky(1)
All times are GMT -4. The time now is 01:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy