Sponsored Content
Top Forums Shell Programming and Scripting Help with sed and replacing white spaces with commas Post 302403605 by Franklin52 on Saturday 13th of March 2010 10:17:29 AM
Old 03-13-2010
Another way:
Code:
awk 'FNR < 5{next}
FNR==5{printf("%s%s", f?"\n":"", FILENAME); f=1}
{$1="";printf $0}
END{printf "\n"}
' ORS=", " OFS=", " *_stats.txt > output.txt

Regards
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. Programming

Removing empty spaces and adding commas

I have a file which contains numbers as follows: 1234 9876 6789 5677 3452 9087 4562 1367 2678 7891 I need to remove the empty spaces and add commas between the numbers like: 1234,9876,6789,5677,3452, 9087,4562,1367,2678,7891 Can anyone tell me the command to do... (4 Replies)
Discussion started by: jazz
4 Replies

6. Shell Programming and Scripting

replacing commas with tilde in csv file.

hello all, i have a comma delimited file. i want to replace the commas in the file with the tilde symbol using sed. how can i do this? thanks. (4 Replies)
Discussion started by: femig
4 Replies

7. Linux

How do i remove commas(,) & spaces

Hey guys, I am very much new to shell scripts. So you ppl may feel that i am asking stupid question here. :D 1. I am using command line argument as an input variable. The user gets this value in his mail from client which has commas n spaces (Eg. 12,34,56,789) and the scripts... (5 Replies)
Discussion started by: anushree.a
5 Replies

8. UNIX for Dummies Questions & Answers

Inserting commas and replacing backslashes with commas

Hi, Newbie here. I have a file that consists of data that I want to convert to a csv file. For example: Jul 20 2008 1111 / visit home / BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLOC-1.1 VendorID/105 Jul 21 2008 22222 / add friend / BlackBerry8830/4.2.2 Profile/MIDP-2.0... (3 Replies)
Discussion started by: kangaroo
3 Replies

9. Shell Programming and Scripting

How to Use Sed Command to replace white spaces with comma from between two fields - Mayank

SHELL SCRIPT Hi I have a file in the following format Mayank Sushant Dheeraj Kunal ARUN Samir How can i replace the white space in between and replace them with a comma?? The resultant output should be Mayank,Sushant Dheeraj,Kunal ARUN,Samir i tried using sed -e... (8 Replies)
Discussion started by: mayanksargoch
8 Replies

10. Shell Programming and Scripting

Replacing white spaces in filename

Hi; In following code find LOG_DIR -type f | while read filename; do echo $filename; done I want to precede each white space encountered in filename with \ so that when i use $filename for running some commands in do...done,it wont give me an error. will appreciate ur help in this.... (1 Reply)
Discussion started by: ajaypadvi
1 Replies
GEDIT(l)																  GEDIT(l)

NAME
gedit - simple text editor for GNOME The gedit application is a simple text editor. You can use gedit to create and edit text files. You can use gedit plugins to perform a variety of tasks related to text-editing from within the gedit window. SYNTAX
gedit [--help] [--debug[-section]] [--new-window] [--new-document] [--quit] [filename(s)...] DESCRIPTION
gedit is a text editor for the GNOME Desktop. OPTIONS
--help Prints the command line options. --debug[-section] Runs gedit in debug mode. In debug mode function names are dumped to the console when they are invoked. Specific sections for debug- ging are allowed. The sections are: window, commands, document, file, plugins, prefs, print, search, undo, view and recent. Run `gedit --help' for more information. --new-window Create a new toplevel window in an existing instance of gedit. --new-document Create a new document in an existing instance of gedit. --quit Quit an existing instance of gedit. filename(s)... Specifies the file to open when gedit starts - if this is not specified, gedit will load a blank file with an Untitled label. Multi- ple files can be loaded if they are separated by spaces. gedit also supports handling of remote files. For example, you can pass the location of a webpage to gedit, like "http://www.gnome.org", or load a file from a FTP server, like "ftp://ftp.gnome.org/ro- bots.txt". PIPES
Gedit accepts pipes, so it can be run after another command to load the output into gedit. For example : ls -l | gedit BUGS
If you find a bug, please report it at http://bugzilla.gnome.org/enter_bug.cgi?product=gedit. AUTHORS
Paolo Maggi (maggi@athena.polito.it) James Willcox (jwillcox@cs.indiana.edu) Federico Mena Quintero (federico@ximian.com) Chema Celorio (chema@celorio.com) 05 Jan 2003 GEDIT(l)
All times are GMT -4. The time now is 08:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy