Sponsored Content
Top Forums Shell Programming and Scripting How to remove spaces on a line? Post 302877955 by almonds on Wednesday 4th of December 2013 03:37:44 AM
Old 12-04-2013
How to remove spaces on a line?

Hi, suppose I have the following data:

Code:
 
albert music=top40 age=20
bob music=punk rock age=25
candy music=r n b age=22
dave music=mozart or bach only age=30

I want to extract and manipulate the music column but it's got spaces in it. How can I substitute the space with an underscore like this:

Code:
 
albert music=top40 age=20
bob music=punk_rock age=25
candy music=r_n_b age=22
dave music=mozart_or_bach_only age=30

 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

Remove extra spaces in a line

Hi, I need a help in deleting extra spaces in a text. I have a huge file, a part of it is :- 3 09/21/08 03:32:07 started undef mino Oracle nmx004.wwdc.numonyx.com Message Text : The Oracle session with the PID 1103 has a CPU time ... (6 Replies)
Discussion started by: vikas027
6 Replies

3. Shell Programming and Scripting

remove trailing spaces from a line

I want to remove the trailing spaces from any line of file. line ending does not follow any pattern. plz help (3 Replies)
Discussion started by: vikas_kesarwani
3 Replies

4. Shell Programming and Scripting

AWK: Remove spaces before processing each line?

Hi, all I have a file containing the following data: name: PRODUCT_1 date: 2010-01-07 really_long_name: PRODUCT_ABCDEFG I want to get the date (it is "2010-01-07" here), I could use the following code to do that: awk... (6 Replies)
Discussion started by: kevintse
6 Replies

5. Shell Programming and Scripting

Remove the spaces at the end of a line starting from a fixed position

I want to remove the trailing spaces at the end of each line starting from a particular position(using ksh script). For example, in the attached file, I want to remove all the spaces starting from the position 430 till the end. The space has to be removed only from the 430th position no matter in... (3 Replies)
Discussion started by: Suryaaravindh
3 Replies

6. Shell Programming and Scripting

How Select numbers from a line of text, and remove leading spaces?

I have a text file with a line of text that contains numbers and text formatted into groups. I need to extract the number that can be either 1,2 or 3 digits long. Then write it to a variable, but i need to remove any leading spaces in the number first. I can get the numbers out but how to remove... (12 Replies)
Discussion started by: kcpoole
12 Replies

7. UNIX Desktop Questions & Answers

To remove the extra spaces at the end of each line in a file

I have a file of about 10k records and eace line is having an extra space of 5 byte at the end.. Iwant to remove the extra spaces at the end of each line.. Can someone please help me out.. I tried using sed command and its not working... can someone please help me out. (3 Replies)
Discussion started by: rammohan
3 Replies

8. UNIX for Dummies Questions & Answers

Using sed to remove spaces from middle of the line

Hi, I need to correct href portion of the lines to edit out spaces from the line starting with position "<a href=" and ending at "target=" Below are 2 examples of extra space added by the server: <td width=251 colspan=9 rowspan=22> <font size=2 face="courier"><tt><style>{font:7pt Courier ... (4 Replies)
Discussion started by: friedmi
4 Replies

9. UNIX for Beginners Questions & Answers

Remove line breaks and extra spaces

Hi, I want to remove all extra spaces, line breaks . Need a new line entry only for term starting"array" For eg: my input is array(), array(), array(), and my expected output is array(), array(), array(), Is it possible using awk? (5 Replies)
Discussion started by: rsi.245
5 Replies

10. UNIX for Beginners Questions & Answers

Tip to remove line endings and spaces on a pre-formatted text file?

Hi, At the moment, using Notepad++ to do a search and replace, manually section by section which is real painful. Yeah, so copying each section of the line of text and putting into a file and then search and replace, need at least 3-operations in Notepad++. Here's hoping I will be able to... (1 Reply)
Discussion started by: newbie_01
1 Replies
LASTFM(1)						      General Commands Manual							 LASTFM(1)

NAME
lastfm - Audio player for last.fm streams SYNOPSIS
/usr/bin/lastfm [options] [URL] DESCRIPTION
This manual page documents briefly the lastfm command. LASTFM is the flagship product from the team that designed the Audioscrobbler system, a music engine based on a massive collection of Music Profiles. Each music profile belongs to one person, and describes their taste in music. Last.fm uses these music profiles to make person- alized recommendations, match you up with people who like similar music, and generate custom radio stations for each person. This program will allow you to play your personalized radio station streams from the last.fm website. OPTIONS
Arguments: URL A station url beginning with lastfm:// Options: --sanity Show the number of listeners instead of the number of plays scrobbled. -tray Start the program minimized as a tray icon. FILES
~/.config/Last.fm/Last.fm.conf Application config file. ~/.local/share/Last.fm/cache/* Cache files for album artwork and artist descriptions. ~/.local/share/Last.fm/IpodDevice.db SQLite database of songs played on the iPod. ~/.local/share/Last.fm/Last.fm.log Application log file. ~/.local/share/Last.fm/*_mediadevice.xml Submission cache of songs played on the iPod. ~/.local/share/Last.fm/*_submissions.xml Submission cache of songs played with the client. AUTHOR
This manual page was written by Paul Telford <pxt@debian.org>, for the Debian project (but may be used by others). It has been updated by John Stamp <jstamp@users.sourceforge.net>. 2007-12-06 LASTFM(1)
All times are GMT -4. The time now is 10:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy