07-02-2012
Use awk (or) gawk command instead .. If not getting expected output, reply with what OS ..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hey ,
I have a file and it's having spaces for some of the fields in it. Like the one below. I want to remove the spaces in them through out the file. The spaces occur randomly and i can't say which field is having space. So please help. Here is sample file with spaces after 5th field. (3 Replies)
Discussion started by: dsravan
3 Replies
2. Shell Programming and Scripting
Hi All,
I have spaces in between file names.
"Material Header.txt"
"Customer Header.txt"
"Vendor Header.txt"
And how can I remove spaces between file names like below
MaterialHeader.txt
CustomerHeader.txt
VendorHeader.txt
Thanks
Srimitta (10 Replies)
Discussion started by: srimitta
10 Replies
3. Shell Programming and Scripting
I'm currently writing my sql results to a file and they have trailing spaces after each field. I want to get rid of these spaces and I'm using this code:
TVXTEMP=$(echo $TVXTEMP|sed -e 's/\ //g')
It doesn't work though. I'm not familiar with sedscript, and the other codes I've found online... (6 Replies)
Discussion started by: avillanueva
6 Replies
4. Shell Programming and Scripting
hi
i have a file which store some data.the contents of my file is
data1:data2
data3:data4
i have a script which read this file
correct="$(cat /root/sh | cut -d: -f1)"
i used this syntax..please help me which syntax is used to remove blank spaces..then how to read this file.. (1 Reply)
Discussion started by: shubhig15
1 Replies
5. UNIX for Dummies Questions & Answers
hey,
I have this file:
ATOM 2510 HG12 VAL 160 8.462 15.861 1.637
ATOM 2511 HG13 VAL 160 9.152 14.510 0.725
ATOM 2512 CG2 VAL 160 6.506 16.579 -0.088
ATOM 2513 HG21 VAL 160 5.499 16.421 -0.478
ATOM 2514 HG22 VAL 160 6.417 16.984 ... (4 Replies)
Discussion started by: kanikasharma
4 Replies
6. Shell Programming and Scripting
I have a file which contains data such as that shown below. How do i remove all the blcnak spaces, before, during and at the end of each line in one command?
300015, 58.0823212, 230.424728
300016, 58.2276459, 229.141602
300017, 58.7590027, 226.960846
... (9 Replies)
Discussion started by: carlr
9 Replies
7. Shell Programming and Scripting
Hi friends,
I have a file1.txt
1 | a | 4757634 | jund jdkj | erhyj
2 | a | 4757634 | jnd jdkj | rhje hjrhwj
i have used tr -d '\040' to remove the spcaes
output file
cat file1.txt | tr -d '\040'
1|a|4757634|jundjdkj|erhyj... (5 Replies)
Discussion started by: i150371485
5 Replies
8. Shell Programming and Scripting
Hi i have a file in which i am doing some processing.
The code is as follows:
#!/bin/ksh
grep DATA File1.txt >> File2.txt
sed 's/DATA//' File2.txt | tr -d ‘ ‘ >> File4.xls
As you can see my output is going in a xl file.The output consist of four columns/feilds out of which the first... (20 Replies)
Discussion started by: Sharma331
20 Replies
9. Shell Programming and Scripting
Hi All,
The output file contains data as below.
"20141023","CUSTOMER" ,"COMPANY" ,"IN0515461" ,"" ,"JOSHUA"
There are spaces in between the ending " and ,. The number of spaces is random.
How can I remove that from the file so that the final output is:... (4 Replies)
Discussion started by: aarsh.dave
4 Replies
10. Shell Programming and Scripting
I've tried various solutions to move a file name with spaces and nothing seems to work. I need to take a date as input, prepend it to a filename with spaces then remove the spaces and mv the file to the new name.
#!/bin/ksh
#
if (( $# != 1 ))
then
echo "Usage: `basename $0` <DATE> "
... (5 Replies)
Discussion started by: w_s_s
5 Replies
SDIFF(1) BSD General Commands Manual SDIFF(1)
NAME
sdiff -- side-by-side diff
SYNOPSIS
sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2
DESCRIPTION
sdiff displays two files side by side, with any differences between the two highlighted as follows: new lines are marked with '>'; deleted
lines are marked with '<'; and changed lines are marked with '|'.
sdiff can also be used to interactively merge two files, prompting at each set of differences. See the -o option for an explanation.
The options are:
-l Only print the left column for identical lines.
-o outfile
Interactively merge file1 and file2 into outfile. In this mode, the user is prompted for each set of differences. See EDITOR and
VISUAL, below, for details of which editor, if any, is invoked.
The commands are as follows:
l Choose left set of diffs.
r Choose right set of diffs.
s Silent mode - identical lines are not printed.
v Verbose mode - identical lines are printed.
e Start editing an empty file, which will be merged into outfile upon exiting the editor.
e l Start editing file with left set of diffs.
e r Start editing file with right set of diffs.
e b Start editing file with both sets of diffs.
q Quit sdiff.
-s Skip identical lines.
-w width
Print a maximum of width characters on each line. The default is 130 characters.
Options passed to diff(1) are:
-a Treat file1 and file2 as text files.
-b Ignore trailing blank spaces.
-d Minimize diff size.
-I regexp
Ignore line changes matching regexp. All lines in the change must match regexp for the change to be ignored.
-i Do a case-insensitive comparison.
-t Expand tabs to spaces.
-W Ignore all spaces (the -w flag is passed to diff(1)).
ENVIRONMENT
EDITOR, VISUAL
Specifies an editor to use with the -o option. If both EDITOR and VISUAL are set, VISUAL takes precedence. If neither EDITOR nor
VISUAL are set, the default is vi(1).
TMPDIR Specifies a directory for temporary files to be created. The default is /tmp.
SEE ALSO
diff(1), diff3(1), vi(1), re_format(7)
AUTHORS
sdiff was written from scratch for the public domain by Ray Lai <ray@cyth.net>.
CAVEATS
Although undocumented, sdiff supports all options supported by GNU sdiff. Some options require GNU diff.
Tabs are treated as anywhere from one to eight characters wide, depending on the current column. Terminals that treat tabs as eight charac-
ters wide will look best.
BUGS
sdiff may not work with binary data.
BSD
February 21, 2007 BSD