Sponsored Content
Full Discussion: GAWK removes FS | on output
Top Forums UNIX for Advanced & Expert Users GAWK removes FS | on output Post 302360697 by danmero on Friday 9th of October 2009 06:39:56 PM
Old 10-09-2009
Set the OFS, see awk cheat sheet (.pdf)
Code:
FS=OFS="|"

This User Gave Thanks to danmero For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script removes itself

I have a script that reads from a file and deletes all files in tha path specified in the file.The problem,however, is the script also deletes itself from the home directory where I run it :-( #!/bin/ksh while read DAYS PURGE_PATH do cd $PURGE_PATH find . \( -type d ! -name . -prune \)... (5 Replies)
Discussion started by: kayarsenal
5 Replies

2. UNIX for Dummies Questions & Answers

eval removes backslash

Hi, ============= In one of my config files, I have below command eval echo RECORDDELIMITER '\n' The above command results in removing backslash and outputs: RECORDDELIMITER n ============= Any workaround to retain the backslash after eval. Appreciated for your... (10 Replies)
Discussion started by: axes
10 Replies

3. Ubuntu

Aptitude removes all packages

Hi Team, Please find below error. I got this after i done something in aptitude. Actually i was trying to update all packages, but unfortunately I removed all packages. Now my server is down. When i boot it gives me me errors of missing .so files. Is there any way to repair my server... (2 Replies)
Discussion started by: paragnehete
2 Replies

4. Shell Programming and Scripting

Gawk output difference

Why the below option2 doesn't fetch similar output as option1 ? I am on linux. $cat test 2013-01-01-00.25.43.643845 Option1: cat test | gawk -F"-" ' {print $2 " " $3 " " $1}' 01 01 2013 Option2: cat test | gawk '{FS="-"} {print $2 " " $3 " " $1}' 2013-01-01-00.25.43.643845 (5 Replies)
Discussion started by: Shivdatta
5 Replies

5. Shell Programming and Scripting

Sed: removes \ from text which causes issues

Hi all, Hoping someone hoping someone might be able to help. i've got the following sed command which i'm using in a bash script that i'm trying to use to insert a new line into an already existing file so i don't have to manually enter it when setting stuff up. the existing script test2/3 are... (3 Replies)
Discussion started by: springs2
3 Replies

6. Shell Programming and Scripting

Trying to learn to use functions in gawk and not getting expected output.

I've been working on improving my awk, and the next thing I want to learn is to properly use functions (I understand functions in shell and python). I have the following code which includes how I did this without functions before, and two attempts I've made to do it with functions: function... (3 Replies)
Discussion started by: DeCoTwc
3 Replies

7. UNIX for Dummies Questions & Answers

Why awk removes delimiters?

Code : echo "1,2,3,4"|awk -F "," 'NR==n{$3=a}1' n=1 a=45 Output : 1 2 45 4 Expected : 1,2,45,4 (4 Replies)
Discussion started by: Rajesh_us
4 Replies

8. Shell Programming and Scripting

Gawk output separated by tab

In the gawk below, I am trying to output the file tab-deliminated but don't think that is the correct syntax. Thank you :). gawk OFS='/t' '{sub(/-+/,"",$2); ar=$0} END{n = asort(ar) for (i = 1; i <= n; i++) print ar}' file (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

awk removes delimiter unexpectedly

datafile: blah,blah,blah,blah,blah,blah,blah,blah,blah=0_nblah=0-- ,blah,blah,blah im using the following command to turn the "_n" and "-- " to just a space " " only in the $9th field. meaning, it has to make the changes only in the 9th column/field of the datafile. awk -F, '{... (1 Reply)
Discussion started by: SkySmart
1 Replies

10. Shell Programming and Scripting

Gawk --- produce the output in pattern space instead of END space

hi, I'm trying to calculate IP addresses and their respective calls to our apache Server. The standard format of the input is HOST IP DATE/TIME - - "GET/POST reuest" "User Agent" HOST IP DATE/TIME - - "GET/POST reuest" "User Agent" HOST IP DATE/TIME - - "GET/POST reuest" "User Agent" HOST... (2 Replies)
Discussion started by: busyboy
2 Replies
FMT(1)							    BSD General Commands Manual 						    FMT(1)

NAME
fmt -- simple text formatter SYNOPSIS
fmt [-Cr] [goal [maximum]] [name ...] fmt [-Cr] [-g goal] [-m maximum] [name ...] DESCRIPTION
fmt is a simple text formatter which reads the concatenation of input files (or standard input if none are given) and produces on standard output a version of its input with lines as close to the goal length as possible without exceeding the maximum. The goal length defaults to 65 and the maximum to 75. The spacing at the beginning of the input lines is preserved in the output, as are blank lines and interword spac- ing. In non raw mode, lines that look like mail headers or begin with a period are not formatted. -C instructs fmt to center the text. -g goal New way to set the goal length. -m maximum New way to set the maximum length. -r Raw mode; formats all lines and does not make exceptions for lines that start with a period or look like mail headers. fmt is meant to format mail messages prior to sending, but may also be useful for other simple tasks. For instance, within visual mode of the ex(1) editor (e.g., vi(1)) the command !}fmt will reformat a paragraph, evening the lines. SEE ALSO
mail(1), nroff(1) HISTORY
The fmt command appeared in 3BSD. BUGS
The program was designed to be simple and fast - for more complex operations, the standard text processors are likely to be more appropriate. BSD
May 29, 2007 BSD
All times are GMT -4. The time now is 07:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy