Sponsored Content
Top Forums Shell Programming and Scripting Splitting based on occurence of a Character at fixed position Post 302835011 by cfajohnson on Sunday 21st of July 2013 10:38:13 AM
Old 07-21-2013
Code:
position=18
char=D

awk -v p="$position" -v c="$char" '
BEGIN { basefile = "txt"; filename = basefile "" ++x }
{print > filename}
(substr($0,p,1) == c) { filename = basefile "" ++x }
' "$file"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sorting a flat file based on multiple colums(using character position)

Hi, I have an urgent task here. I am required to sort a flat file based on multiple columns which are based on the character position in that line. I am restricted to use the character position instead of the space and sort +1 +2 etc to do the sorting. I understand that there is a previous... (8 Replies)
Discussion started by: cucubird
8 Replies

2. Shell Programming and Scripting

Append line based on fixed position

Hi all; I'm having headache on append one line to another based on the fix position.Hope u guys can help. All i need to do is append the line that start with '3' to a line which start with '1' and the position for line 3 that i need to append is 22. The original file look like this: ... (2 Replies)
Discussion started by: ashikin_8119
2 Replies

3. Shell Programming and Scripting

Cut multiple data based on character position

How to extract multiple data based on character position. I need to fetch from 7-9 and 22-26 and there is no delimiter for 22-26 since it is part of the column. The file may have more than 1000 character long.I managed to pull any one but not both for example test data 12345 zxc vbnmlk... (1 Reply)
Discussion started by: zooby
1 Replies

4. UNIX for Dummies Questions & Answers

Using grep to check for character at fixed position

i have a file (test.txt) that contains: 20799510617900000928000000005403020110315V 20799510617900000928000000005403020110316 20799510617900000928000000005403020110317 20799510617900000928000000005403020110318V grep V test.txt > /tmp/void.log if then mail -s "void" < test.txt fi... (2 Replies)
Discussion started by: tjmannonline
2 Replies

5. Linux

Linux script to remove a character in a file based on position.

Greetings, We have a requirement where we need to loop in a fixed width file in linux and remove a character based on a position for every record. It would highly appreciate if someone can help to automate this. Appreciate your time and help! Regards (3 Replies)
Discussion started by: mailme0205
3 Replies

6. Shell Programming and Scripting

Splitting file based on pattern and first character

I have a file as below pema.txt s2dhshfu dshfkdjh dshfd rjhfjhflhflhvflxhvlxhvx vlvhx sfjhldhfdjhldjhjhjdhjhjxhjhxjxh sjfdhdhfldhlghldhflhflhfhldfhlsh rjsdjh#error occured# skjfhhfdkhfkdhbvfkdhvkjhfvkhf sjkdfhdjfh#error occured# my requirement is to create 3 files frm the... (8 Replies)
Discussion started by: pema.yozer
8 Replies

7. UNIX for Dummies Questions & Answers

Change a character based on its position number

Hi I have a text file that I want to change some of the characters based on their position. My file contain multiple lines and characters should be counted continuously line by line. For example, I want to convert the 150th T to C. What can I do? Here is a portion of my file:... (10 Replies)
Discussion started by: a_bahreini
10 Replies

8. Shell Programming and Scripting

Fixed width file search based on position value

Hi, I am unable to find the right option to extract the data in the fixed width file. sample data abcd1234xgyhsyshijfkfk hujk9876 io xgla loki8787eljuwoejroiweo dkfj9098 dja Search based on position 8-9="xg" and print the entire row output ... (4 Replies)
Discussion started by: onesuri
4 Replies

9. Shell Programming and Scripting

Search for a string at a particular position and replace with blank based on position

Hi, I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies

10. UNIX for Beginners Questions & Answers

Splitting the file based on two fields - Fixed length file

Hi , I am having a scenario where I need to split the file based on two field values. The file is a fixed length file. ex: AA0998703000000000000190510095350019500010005101980301 K 0998703000000000000190510095351019500020005101480 ... (4 Replies)
Discussion started by: saj
4 Replies
mdoc-assemble(1)					      General Commands Manual						  mdoc-assemble(1)

NAME
mdoc assemble - Compile documentation for use in monodoc(1) SYNOPSIS
mdoc assemble [OPTIONS]+ PATHS+ DESCRIPTION
mdoc assemble creates .tree and .zip files from PATHS for use in the monodoc(1) documentation browser. The input files must have a supported format, specified with the --format option. The .tree and .zip files are copied into monodoc's sources directory, alongside a .source file which is used by monodoc(1) to specify where the documentation should be displayed. The .source file has the following format: <?xml version="1.0"?> <monodoc> <node label="LABEL" name="PATH" parent="PARENT"> <node label="LABEL2" name="PATH2" /> <!-- ... --> </node> <source provider="PROVIDER" basefile="BASEFILE" path="PATH" /> <!-- other <source/> elements --> </monodoc> The /monodoc/node node is an optional node that specifies where in the monodoc tree the documentation should be displayed, and //node ele- ments may be nested to any depth to create trees. //node/@label is the label that will be displayed within the monodoc tree. //node/@name is the name of the monodoc tree node, and may be used as the value of the /monodoc/source/@path value. //node/@parent is the node name to use as the parent node. $MONO_INSTALL_PREFIX/lib/monodoc/monodoc.xml contains a list of such names, and this can be any //node/@name value. If the //node/@parent value isn't found, then it's inserted under the "Various" tree node. The /monodoc/source/@provider attribute specifies which format provider should be used when reading the .tree and .zip files; this must correspond to one of the --format values. The /monodoc/source/@basefile attribute specifies the filename prefix for the documentation files. This must be the same prefix as used with the --out parameter. There should be no filename extension on this value. The /monodoc/source/@path attribute specifies the parent node in monodoc(1)'s tree view where the documentation will be inserted. See the $MONO_INSTALL_PREFIX/lib/monodoc/monodoc.xml file for a list of PATH values (the //node/@name values), or it may be a //node/@name value in the same .source file. Once the BASEFILE.source has been written, the documentation can be installed so that monodoc(1) will display the documentation with the command: cp BASEFILE.source BASEFILE.tree BASEFILE.zip `pkg-config monodoc --variable=sourcesdir` OPTIONS
-f, --format=FORMAT Specifies the documentation format used within PATHS. Valid FORMAT values include: ecma, ecmaspec, error, hb, man, simple, and xhtml. See the FORMATS section below for more information about these formats. The default format (if none is specifed) is ecma. The --format option may be interleaved with PATHS to change the format used for the remaining parameters (until the next --format option is seen), e.g.: mdoc assemble -o PREFIX A B --format=man C D --format=xhtml E will assemble directories A and B with the ecma format, files C and D with the man formt, and directory E with the xhtml format. -o, --out=PREFIX Specify the output file prefix. mdoc assemble creates the files PREFIX.zip and PREFIX.tree. -h, -?, --help Display a help message and exit. FORMATS
The following documentation formats are supported: ecma The Mono ECMA Documentation Format, an XML documentation format with one file per type. See the mdoc(5) man page for more information. ecmaspec The Mono ECMA Specification Documentation Format. This is not the format you're looking for; it is the format used to represent the ECMA-334 (C#) standard within monodoc(1). It is not used to display class library documentation; for class library documentation, use the ecma format. error The Error Documentation Format is used to present detailed error messages, and is used in monodoc(1)'s "C# Compiler Error Reference" tree. In this format, PATHS is a configuration file, containing the XML: <ErrorProviderConfig> <FilesPath>../../mcs/errors</FilesPath> <Match>cs????*.cs</Match> <ErrorNumSubstringStart>2</ErrorNumSubstringStart> <ErrorNumSubstringLength>4</ErrorNumSubstringLength> <FriendlyFormatString>CS{0:0###}</FriendlyFormatString> </ErrorProviderConfig> The elements mean: /ErrorProviderConfig/FilesPath Specifies where to look for files. /ErrorProviderConfig/Match Specifies the filename pattern to look for within the /ErrorProviderConfig/FilesPath directory. /ErrorProviderConfig/ErrorNumSubstringStart Specifies where within the filename the error number starts. /ErrorProviderConfig/ErrorNumSubstringLength Specifies how many characters after /ErrorProviderConfig/ErrorNumSubstringStart to use for the error number. /ErrorProviderConfig/FriendlyFormatString Specifies the formatting/display of the node in the monodoc(1) tree. For each file found, it is converted to HTML with C# syntax coloring applied. simple The Simple Documentation Format file format recursively adds all files and directories underneath PATHS. When displayed, HTML files are displayed as-is. Text files are converted into HTML by translating each newline into an HTML <br> element. No other file type is sup- ported. man The Man Page Documentation Format displays groff man pages. (This is not a full groff parser, and only handles the man page constructs used within the mono man pages.) PATHS is a set of XML files containing: <?xml version="1.0"?> <manpages> <manpage name="NAME" page="FILE" /> </manpages> There may be multiple //manpage elements within the root /manpage element. The /manpages/manpage/@name attribute contains the display name for the tree view node, which is also the URL of the man page when using monodoc(1)'s Lookup URL command (before prefixing with a man: prefix). Thus, if /manpages/manpage/@name contains mono(1), then man:mono(1) can be used in the Lookup URL command to view the mono(1) man page. The /manpages/manpage/@page attribute is the filename that contains the man page. If this file does not exist, then /manpages/man- page/@name will not be displayed within the tree view. xhtml The XHTML provider interprets PATHS as a Windows Help file XHTML TOC file and looks for referenced documents to create the help source. SEE ALSO
mdoc(1), mdoc(5), monodoc(1) MAILING LISTS
Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details. WEB SITE
See also: http://www.mono-project.com/mdoc mdoc-assemble(1)
All times are GMT -4. The time now is 07:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy