Sponsored Content
Top Forums Shell Programming and Scripting OFS does not apply to few records in awk Post 302799989 by Corona688 on Sunday 28th of April 2013 01:54:04 PM
Old 04-28-2013
It doesn't alter the input line at all unless you do something to one of the tokens.

If that's all you want, awk is overkill anyway, try tr ':' ',' < inputfile > outputfile
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

OFS in awk

Hi, I have these out put field seperator changed to "|" in my awk command, but it didn't give me the result. Can someone help me find out why? ======================================= /bin/awk 'BEGIN { OFS="|" } { print $0 }' list.tmp.$$ > listtmp.$$ =======================================... (1 Reply)
Discussion started by: whatsfordinner
1 Replies

2. Shell Programming and Scripting

OFS in awk.

OFS is inbuild command in awk. I have a file file.txt abc : def : ghi jkl : mno: pqr stu : vwx :yzz code i used: awk -F ":" 'BEGIN {OFS="|"} {print $1,$2}' file.txt output: abc def jkl mno stu vwx but as i have used OFS="|" and i am expecting output as: abc | def jkl... (4 Replies)
Discussion started by: salil2012
4 Replies

3. Shell Programming and Scripting

AWK - OFS

Hi All, I have a comma seperated delimited file with 10 columns. I need to convert it into TAB seperated delimited file. awk -F"," '{print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10}' a.txt >> b.txt how to use OFS to get the same output. I have tried by googling, but it... (5 Replies)
Discussion started by: Amit.Sagpariya
5 Replies

4. Shell Programming and Scripting

Apply condition on fixed width file and filter records

Dear members.. I have a fixed width file. Requirement is as below:- 1. Scan each record from this fixed width file 2. Check for value under field no "6" equals to "ABC". If yes, then filter this record into the output file Please suggest a unix command to achieve this, my guess awk might... (6 Replies)
Discussion started by: sureshg_sampat
6 Replies

5. UNIX for Dummies Questions & Answers

Problem with AWK and OFS

I have a file that looks like this: Infile.seq I want to output the DNA sequence and add the filename as the identifier. The output file should look like this: I am using the following code but I do not understand why the sequence is not in the output: awk 'BEGIN { RS =... (11 Replies)
Discussion started by: Xterra
11 Replies

6. Shell Programming and Scripting

Awk OFS issues

Hi Im trying to tidy up the output of a who command when it writes to a log, everything I've tried doesnt seem to work though, any help would be massively appreciated. Im using the awk command to set the OFS as tab. #!/bin/bash who >> /export/home/tjmoore/logusers awk -F 'BEGIN... (3 Replies)
Discussion started by: 02JayJay02
3 Replies

7. Shell Programming and Scripting

Awk OFS issues

Hi, Could anyone tell me what Im doing wrong here any help will be much appreciated #!/bin/bash ls -ltr /export/home/tjmoore > /export/home/tjmoore/log100 awk -F " " /export/home/tjmoore/log100 'BEGIN {OFS="\t";} {print $1,$2,$3,$4,$5, $6,$7,$8,$9;}' > /export/home/tjmoore/log1001 I... (9 Replies)
Discussion started by: 02JayJay02
9 Replies

8. UNIX for Dummies Questions & Answers

OFS in awk

Hello, I have an issue with adding commas as delimiters in this scenario: cat xtr3.rpl|head -5|awk 'BEGIN {OFS=","} {print $1,$2,$3,$4}' Produces this output: 00530083,0000000471,000000000000.00,000000000000.00 00530085,0000000471,000000000000.00,000000000000.00... (10 Replies)
Discussion started by: MIA651
10 Replies

9. Shell Programming and Scripting

OFS print awk

file: sasa|asasa|asasa|asas erer|Erer|rere|ererer Output needed : sasa:asasa:asasa:asas erer:Erer:rere:ererer Im getting output, when i use the $1,$2. awk -F'|' 'BEGIN{OFS=":";} {print $1,$2; }' file Output : sasa:asasa erer:Erer But when i need the whole column, i... (5 Replies)
Discussion started by: Ramesh M
5 Replies

10. Shell Programming and Scripting

awk - OFS printing duplicate. Why?

Why the following code printing duplicate records? bash-4.1$ cat rm1 c1 c2 c3 l1 2 3 4 l2 2 3 2 bash-4.1$ awk '{print $0} OFS = "\n"' rm1 c1 c2 c3 c1 c2 c3 l1 2 3 4 l1 2 3... (4 Replies)
Discussion started by: quincyjones
4 Replies
cdoc(1) 						      General Commands Manual							   cdoc(1)

Name
       cdoc - invokes CDA Converter

Syntax
       cdoc [ -s format ] [ -d format ] [ -O options_file ] [ -o outputfile ] inputfile

Description
       The command converts the revisable format file, inputfile, to another revisable format or to a final form file.	If inputfile is not speci-
       fied, reads from standard input.  Unless a destination file is specified with the -o option, the command writes files to standard output.

Options
       -s format	   Specifies the format of inputfile and invokes an appropriate input converter as part of CDA. The ddif, dtif, dots  (for
			   analysis  output  only) and text converters are provided in the base system kit.  Additional converters can be added by
			   the CDA Converter Library and other layered products.  Converter Library and other layered products.  Contact your sys-
			   tem manager for a complete list of the input formats supported on your system. The default format is ddif.

       -d format	   Specifies  the  format  of outputfile and invokes an appropriate output converter as part of CDA. The ddif, dtif, text,
			   analysis, and ps converters are provided in the base system kit. Additional converters can be added	by  the  CDA  Con-
			   verter  Library  and other layered products. Contact your system manager for a complete list of the output formats sup-
			   ported on your system.  The default format is ddif.

       -O options_file	   Names the file passed to the input and output converters to control specific processing  options  for  each	converter.
			   Refer to your documentation set for a description of converter options.

			   The	options  file  has a default file type of .cda_options. Each line of the options file specifies a format name that
			   can optionally be followed by _input or _output to restrict the option to either an input or output converter. The sec-
			   ond	word  is  a valid option preceded by one or more spaces, tabs, or a slash (/) and can contain upper- and lowercase
			   letters, numbers, dollar signs, and underlines. The case of letters is not significant. If an option requires a  value,
			   then spaces, tabs, or an equal sign can separate the option from the value.

			   Each  line  can  optionally be preceded by spaces and tabs and can be terminated by any character other than those that
			   can be used to specify the format names and options. The syntax and interpretation of the text that follows the  format
			   name is specified by the supplier of the front and back end converters for the specified format.

			   To  specify several options for the same input or output format, specify one option on a line. If an invalid option for
			   an input or output format or an invalid value for an option is specified, the option may be ignored or an error message
			   may	be  returned.  Each  input or output format that supports processing options specifies any restrictions or special
			   formats required when specifying options.

			   By default, any messages that occur during processing of the options file are written  to  the  system  standard  error
			   location.  For those input and output formats that support a LOG option, messages can be directed to a log file.

       -o outputfile	   Specifies the name of the output file.  If not specified, writes to standard output.

See Also
       vdoc(1), dxvdoc(1X), DDIF(5), DTIF(5), DOTS(5), CDA(5)

																	   cdoc(1)
All times are GMT -4. The time now is 08:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy