I have a CSV file with footer information as below. The third value is the number of records in the file. Sometimes it contains both leading and trailing white spaces which i want to trim using awk.
Above is the command which is already present in production and this statement fails since the $3 has spaces in it. So far we didn't get any spaces in the CSV, so this statement was working fine for the past 1 year.
Is there any way to trim the spaces(both leading and trailing spaces) in AWK?
Hi Friends,
Can any one help with this issue:
How to trim spaces for each line at the end,
Like I have a file in this format.
EMP1 SMITH 46373 5 STREET HOWARD 74636
EMP2 JONES 5454 { these are spaces ........}
EMP3 SMITH 46373 5 STREET HOWARD 74636
EMP4 JON 2554 { these are... (1 Reply)
I am coding a C program to read a plain text file. There are a lot of blank fields or a string with white spaces. I want to know is there such a function called trim() in C to clean the white space around a string? Or some other way can do this efficiently? Thanks. (18 Replies)
Hi,
I'm new to shell programming. Need some help in the following requirement:
I have a file origFile.txt with values:
origFile.txt
.00~ 145416.02~ xyz~ ram kishor
.35~ 765.76~ anh reid~ kishna kerry
Now each row in the file has value for 4 columns with "~" as... (7 Replies)
Hi,
I have a file origFile.txt with values:
origFile.txt
.00~ 145416.02~ xyz~ ram kishor ~? ~ ~783.9
.35~ 765.76~ anh reid~ kelly woodburg ~nancy ~ ~?
Now each row in the file has value for 7 columns with "~" as delimiter.
The requirement was
i)I need to erase the blank spaces between... (2 Replies)
Hi,
I am using gawk (--posix) for extracting some information from something like the following lines (in a text file):
sms_snath_hp_C/CORE BUILD PREREQUISITE:
total 1556
drwxrwxrwx 2 sn sn 4096 2008-06-27 08:31 ./
drwxrwxrwx 13 sn sn 4096 2009-07-22 14:48 ../
-rwxrwxrwx 1 sn sn ... (14 Replies)
HI Guys
I have written a script using awk to split a file based on some identifier and renaming the file based on two values from specific length. ts a fixed width file.
When I am trying to fetch the values
a = substr($0,11,10)
b = substr($0,21,5);
i am getting spaces in a and b values .... (6 Replies)
Hi,
Consider the data (FS = |):
1| England |end
2| New Zealand |end
3|Australia|end
4| Some Made Up Country |end
5| West Indies|end
I want the output to be (i.e. without the leading and trailing white space from $2)
England
New Zealand
Australia
Some Made Up Country
West... (4 Replies)
All,
i am comparing the output of one command to a numberic
if ]
but my problem is the output of follwoing is but but has some leading columns. I don't have any problme in LINUX and HP-UX. But only in AIX i am getting the leading spaces. I have developed my script on LINUX but when... (4 Replies)
I have a file like this.
hari,corporationbank,2234356,syndicate
ravi,indian bank,4567900000000,indianbank,accese
raju,statebank of hyderabad,565866666666666,pause
Here each record has different record length and there are blank spaces... (8 Replies)
Discussion started by: kshari8888
8 Replies
LEARN ABOUT DEBIAN
gofmt
GOFMT(1) General Commands Manual GOFMT(1)NAME
gofmt - formats Go programs
SYNOPSIS
gofmt [flags] [ path ... ]
DESCRIPTION
Without an explicit path, it processes the standard input. Given a file, it operates on that file; given a directory, it operates on all
.go files in that directory, recursively. (Files starting with a period are ignored.) By default, gofmt prints the reformatted sources to
standard output.
OPTIONS -d Do not print reformatted sources to standard output. If a file's formatting is different than gofmt's, print diffs to standard out-
put.
-e Print all (including spurious) errors.
-l Do not print reformatted sources to standard output. If a file's formatting is different from gofmt's, print its name to standard
output.
-r rule
Apply the rewrite rule to the source before reformatting.
-s Try to simplify code (after applying the rewrite rule, if any).
-w Do not print reformatted sources to standard output. If a file's formatting is different from gofmt's, overwrite it with gofmt's
version.
Formatting control flags:
-comments=true
Print comments; if false, all comments are elided from the output.
-tabs=true
Indent with tabs; if false, spaces are used instead.
-tabwidth=8
Tab width in spaces.
The rewrite rule specified with the -r flag must be a string of the form:
pattern -> replacement
Both pattern and replacement must be valid Go expressions. In the pattern, single-character lowercase identifiers serve as wildcards match-
ing arbitrary sub-expressions; those expressions will be substituted for the same identifiers in the replacement.
When gofmt reads from standard input, it accepts either a full Go program or a program fragment. A program fragment must be a syntactically
valid declaration list, statement list, or expression. When formatting such a fragment, gofmt preserves leading indentation as well as
leading and trailing spaces, so that individual sections of a Go program can be formatted by piping them through gofmt.
EXAMPLES
To check files for unnecessary parentheses:
gofmt -r '(a) -> a' -l *.go
To remove the parentheses:
gofmt -r '(a) -> a' -w *.go
To convert the package tree from explicit slice upper bounds to implicit ones:
gofmt -r 'a[B:len(a)] -> a[B:]' -w $GOROOT/src/pkg
BUGS
The implementation of -r is a bit slow.
AUTHOR
This manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others).
2012-05-13 GOFMT(1)