Sponsored Content
Top Forums Shell Programming and Scripting refine awk command in replacing carriage return Post 302544504 by shipra_31 on Thursday 4th of August 2011 04:20:46 AM
Old 08-04-2011
you may remove the empty line before using the awk command ...

so if ur input is in sample file then u may use

Code:
grep -v '^$' sample | awk -F\| 'FNR==1{n=NF}NF<n{l=$0;getline;$0=l"
:::"$0}1'
col1|col2|col3|col4|col5|col6|col7|Remarks|col9|col10
A_1|11|12|13|14|15|16|Testing :::remarks|18|19
A_2|21|22|23|24|25|26|Testing:::remarks|28|29


Last edited by radoulov; 08-04-2011 at 06:58 AM.. Reason: Code tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Dont want carriage return

I have observed with print & echo, they produce carriage return <CR> or newline, after they display string next to them. Is there anyway to avoide these <CR> after the intended string is displayed? (3 Replies)
Discussion started by: videsh77
3 Replies

2. Shell Programming and Scripting

Carriage return on long awk operation

hello all I have long awk function that doing manipulations on text file but when I write the out put to new text file I have carriage return between 2 print commands How can I avoid this ? Here is my awk : echo $f | awk... (1 Reply)
Discussion started by: umen
1 Replies

3. Shell Programming and Scripting

tcl command to supply a carriage return

I have a java program that runs on a unix server that prompts the user for input and provides a default value to the user. So it does something like this: Enter source server name <source_server_name>: Enter target server name <target_server_name>: I just hit enter to take the default... (1 Reply)
Discussion started by: progkcp
1 Replies

4. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

5. Shell Programming and Scripting

Refine awk

Hi The commnad shows the following o/p df -kh /abc/bds/ |awk {'print$5'} capacity 87% I want the o/p as 87 only Can we achieve this using a oneliner of sorts NB : Code tags not working with my google chrome , So wasn't able to place code in tags . Pls dont penalise :-) Thanks (6 Replies)
Discussion started by: ultimatix
6 Replies

6. Shell Programming and Scripting

Why sed command deletes last line in a file if no carriage return?

Hi I am using sed command to make SCORE=somevalue to SCORE=blank in a file. Please see the attached lastline.txt file. After executing the below command on the file, it removes the last line. cat lastline.txt | sed 's/SCORE=.*$/SCORE=/g' > newfile.txt Why does sed command remove the... (3 Replies)
Discussion started by: ashok.k
3 Replies

7. Shell Programming and Scripting

Awk to remove carriage return from 65th field

Hi, I have a pipe delimited file. There are around 700 columns in the file. The 65th column has carriage return which is causing read issue with our ETL process. I would like to replace the new line characters in 65th field with "nothing" i have return the following code and need help to... (7 Replies)
Discussion started by: pinnacle
7 Replies

8. Shell Programming and Scripting

Substitute \n with carriage return

Hello all, I've a flat file in the following format: AB\001\CDED\001\ABC\001\nEG\001\HIJF\001\EFG\001\nHI\003\HIUL\003\HIJ\003 And I want to substitute \n with the carriage return. Any help is appreciated! Regards, - Seth (8 Replies)
Discussion started by: sethmj
8 Replies

9. Shell Programming and Scripting

Losing carriage return (X0D) after running awk command

Hi Forum. I'm running the following awk command to extract the suffix value (pos 38) from the "AM00" record and append to the end of the "AM01" record. awk 'substr($0,13,4)=="AM00" {SUFFIX = substr($0,38,2)} substr($0,13,4)=="AM01" {$0 = $0 SUFFIX} 1' before.txt > after.txt Before.txt:... (2 Replies)
Discussion started by: pchang
2 Replies

10. UNIX for Beginners Questions & Answers

awk Command to add Carriage Return and Line Feed

Hello, Can someone please share a Simple AWK command to append Carriage Return & Line Feed to the end of the file, If the Carriage Return & Line Feed does not exist ! Thanks (16 Replies)
Discussion started by: rosebud123
16 Replies
mdoc-export-html(1)					      General Commands Manual					       mdoc-export-html(1)

NAME
mdoc export-html - Convert mdoc(5) XML to HTML. SYNOPSIS
mdoc export-html [OPTION]* DIRECTORIES DESCRIPTION
mdoc export-html creates HTML files from the mdoc(5)-formatted documentation XML files within DIRECTORIES. OPTIONS
--default-template Writes the default XSLT used to stdout. --ext=EXTENSION The file extension to use for created files. This defaults to html. --force-update Always generate new files. If not specified, will only generate a new output file if the source documentation file is newer than the target output file. -o, --out=DIRECTORY Write the created files within directory DIRECTORY. --template=FILE An XSLT file to use to generate the created files. If not specified, uses the template produced by --dump-template. See the TEMPLATE FORMAT section below for more information. --with-profile=PROFILE Only process types and members within the .NET profile PROFILE. May be specified multiple times. If not specified, all types and members, regardless of version, are processed. Valid profiles are: monotouch net_1_0 net_1_1 net_2_0 net_3_0 net_3_5 net_4_0 silverlight --with-version=VERSION Only process types and members within the assembly version VERSION. May be specified multiple times. If not specified, all types and members, regardless of version, are processed. VERSION is an assembly version, e.g. 2.0.5.0. -h, -?, --help Display a help message and exit. TEMPLATE FORMAT
The template file is an XSLT which needs to process the following input XML document: <Page> <CollectionTitle>Collection Title</CollectionTitle> <PageTitle>Page Title</PageTitle> <Summary>Page Summary</Summary> <Signature>Type Declaration</Signature> <Remarks>Type Remarks</Remarks> <Members>Type Members</Members> <Copyright>Documentation Copyright</Copyright> </Page> The generated HTML also makes use of several CSS classes. You can either use the create-default-style named template found within the --default-template output to generate these classes, or explicitly define the following CSS classes: .CollectionTitle .PageTitle .Summary .Signature .Remarks .Members .Copyright .Section .SectionBox .NamespaceName .NamespaceSummary .MemberName .MemberSignature .MemberBox .Subsection .SubsectionBox .SignatureTable .EnumerationsTable .CodeExampleTable .MembersListing .TypesListing .InnerSignatureTable .TypePermissionsTable HTML LINKS
All members within the HTML file have an id attribute to permit linking to a specific member. The value of the id attribute is the String ID of the specified member. See the CREF FORMAT section of mdoc(5) for more information. MAILING LISTS
Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details. WEB SITE
Visit http://www.mono-project.com/mdoc for details mdoc-export-html(1)
All times are GMT -4. The time now is 02:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy