Sponsored Content
Full Discussion: Leading white spaces
Top Forums Shell Programming and Scripting Leading white spaces Post 302453697 by scripter12 on Thursday 16th of September 2010 05:26:44 AM
Old 09-16-2010
Leading white spaces

Hi,

I am having problem in deleting the leading spaces:-

Code:
cat x.csv
baseball,NULL,8798765,Most played
baseball,NULL,8928192,Most played
baseball,NULL,5678945,Most played
cricket,NOTNULL,125782,Usually played
cricket,NOTNULL,678921,Usually played

$ nawk 'BEGIN{FS=","}!a[$1] {print;a[$1]++;next}{print "\t"FS$2FS$3FS$4}' x.csv >y.csv
$ cat y.csv
baseball,NULL,8798765,Most played
        ,NULL,8928192,Most played
        ,NULL,5678945,Most played
cricket,NOTNULL,125782,Usually played
        ,NOTNULL,678921,Usually played

$  sed 's/^[ \t]*//' y.csv > z.csv
$ cat z.csv
baseball,NULL,8798765,Most played
        ,NULL,8928192,Most played
        ,NULL,5678945,Most played
cricket,NOTNULL,125782,Usually played
        ,NOTNULL,678921,Usually played

$ uuencode z.csv z.csv | mailx a.com

when i send it through mail to my personal mail id I can see a box sign in the csv sheet in windows..
can somebody please help me to resolve this
Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Leading and Trailing Spaces

Hi, how to i remove leading and trailing spaces from a line? the spaces can be behind or in front of any field or line example of a line in the input data: Amy Reds , 100 , /bin/sh how to i get it to be: Amy Read,100,/bin/sh i saw something on this on the Man pages for AWK... (7 Replies)
Discussion started by: sleepster
7 Replies

2. UNIX for Dummies Questions & Answers

deleting white spaces

How would I delete white spaces in a specified file? Also, I'd like to know what command I would use to take something off a regular expression, and put it onto another. ie. . . . expression1 <take_off> . . . expression2 (put here) . . . Any help would be great, thanks! (10 Replies)
Discussion started by: cary530
10 Replies

3. Shell Programming and Scripting

Strip leading and trailing spaces only in a shell variable with embedded spaces

I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help. echo $SH_VAR | command_line Syntax. The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies

4. Shell Programming and Scripting

delete white spaces

hi all... i have the next question: i have a flat file with a lot of records (lines). Each record has 10 fields, which are separated by pipe (|). My problem is what sometimes, in the first record, there are white spaces (no values, nothing) in the beginning of the record, like this: ws ws... (2 Replies)
Discussion started by: DebianJ
2 Replies

5. Shell Programming and Scripting

trimming white spaces

I have a variable that calls in a string from txt file. Problem is the string comes with an abundance of white spaces trailing it. Is there any easy way to trim the tailing white spaces off at the end? Thanks in advance. (9 Replies)
Discussion started by: briskbaby
9 Replies

6. Shell Programming and Scripting

Two or more white spaces in string

Hi, Can anybody suggest me how to combine two strings with two or more white spaces and assign it to a variable? E.g. first=HAI second=HELLO third="$first $second" # appending strings with more than one white spaces echo $third this would print HAI HELLO Output appears... (2 Replies)
Discussion started by: harish_oty
2 Replies

7. Shell Programming and Scripting

remove leading spaces from a line

Hi friends I need some help, I have a file which looks as follows TEMP 014637065 014637065 517502 517502 RTE 517502 517502 RTE AWATER_TEST 12325 23563 588323 2323 5656 32385 23235635 ANOTHER_TEST 12 5433 FTHH 5653 833 TEST 123 123 3235 5353 353 53 35 353 535 3 YTERS GJK JKLS ... (6 Replies)
Discussion started by: lijojoseph
6 Replies

8. Shell Programming and Scripting

Not able to remove leading spaces

Hi Experts, In a file tht i copied from the web , i am not able to remove the leading white spaces. I tried the below , none of them working . I opened the file through vi to check for the special characters if any , but no such characters found. Your advice will be greatly appreciated. sed... (5 Replies)
Discussion started by: panyam
5 Replies

9. Shell Programming and Scripting

Preserve leading white space

I have about 350 programs in which I have to add 2 lines; one before and one after a specfic line. The following script does the job except that I lose the indentation. #!/usr/bin/bash while read line ... (8 Replies)
Discussion started by: jgt
8 Replies

10. Shell Programming and Scripting

Trying to remove leading spaces

OS : RHEL 6.7 Shell : bash I am trying to remove the leading the spaces in the below file $ cat pattern2.txt hello1 hello2 hello3 hello4 Expected output is shown below. $ cat pattern2.txt hello1 hello2 hello3 hello4 (2 Replies)
Discussion started by: John K
2 Replies
exsample(3alleg4)						  Allegro manual						 exsample(3alleg4)

NAME
exsample - Playing digital samples. Allegro game programming library. SYNOPSIS
#include <allegro.h> Example exsample DESCRIPTION
This program demonstrates how to play samples. You have to use this example from the command line to specify as first parameter a WAV or VOC sound file to play. If the file is loaded successfully, the sound will be played in an infinite loop. While it is being played, you can use the left and right arrow keys to modify the panning of the sound. You can also use the up and down arrow keys to modify the pitch. SEE ALSO
END_OF_MAIN(3alleg4), SAMPLE(3alleg4), SCREEN_H(3alleg4), SCREEN_W(3alleg4), adjust_sample(3alleg4), allegro_error(3alleg4), alle- gro_init(3alleg4), allegro_message(3alleg4), clear_to_color(3alleg4), desktop_palette(3alleg4), destroy_sample(3alleg4), font(3alleg4), install_keyboard(3alleg4), install_sound(3alleg4), install_timer(3alleg4), key(3alleg4), load_sample(3alleg4), makecol(3alleg4), play_sam- ple(3alleg4), poll_keyboard(3alleg4), rest(3alleg4), screen(3alleg4), set_gfx_mode(3alleg4), set_palette(3alleg4), textprintf_cen- tre_ex(3alleg4) Allegro version 4.4.2 exsample(3alleg4)
All times are GMT -4. The time now is 04:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy