Sponsored Content
Top Forums Shell Programming and Scripting Help me please: UNIX command to extract substring not squeeze spaces Post 302688897 by sophiez16 on Monday 20th of August 2012 11:57:13 AM
Old 08-20-2012
Hi vbe,

Thank you so much for the reply...

Yes, your code works (export str=" \ test1 \ \ test2 test3 ").

But I cannot insert \ into the str. The str=" test1 test2 test3 " is what I got by retrieving the data row by row from a feed file.

Is there a way to not sequeeze spaces by using str=" test1 test2 test3 "?

Thank you again,
Sophie

---------- Post updated at 11:57 AM ---------- Previous update was at 11:49 AM ----------

Hi Corona688,

The command works :-)

echo "${STRING:BEGIN:LENGTH}"


I am using ksh.

Thank you so much!
Sophie
This User Gave Thanks to sophiez16 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command/script to extract a substring from a string

I have a long string "<ID type="Oid">{}</ID>" I need to extract "GigabitEthernet0/1" from the above string. How can it be done? :) (5 Replies)
Discussion started by: girisha
5 Replies

2. UNIX for Dummies Questions & Answers

how to extract a substring froma file

hi all, I'm really newbie on this and I need some help. how is the best way to extract a strig or substring from a each line in a file. e.g. I want to print only this ERROR=JUD+the followed numbers from one line like this one, considering the numbers change related to different errors ... (1 Reply)
Discussion started by: morena
1 Replies

3. Shell Programming and Scripting

Sed extract substring on (OS X)

On OS 10.4.11 I have filenames like: 670711 SA T2 v1-1_DS_EF.doc CT_670520 AM T1 v1-2_DS_EF.doc CT_670716 - 2 SA T4 v1-2_DS_EF.doc CT_670713 SA T3 v1-1_DS_EF.doc 670421 PA DYP1 v1-1_DS_EF.doc CT_670425 PA DYP2 v1-1_DS_EF.doc CT_670107 RA T3 v1-2_DS_EF.doc CT_670521 AM T2 v1-2_DS_EF.doc... (3 Replies)
Discussion started by: mlommel
3 Replies

4. Shell Programming and Scripting

Need Help... to extract the substring

> tnsping $TWO_TASK | grep HOST Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.10.212)(PORT = 1540)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = OMTST15))) I want to extract like this HOST = 10.12.10.212 PORT = 1540 SERVICE_NAME = OMTST15 I... (4 Replies)
Discussion started by: dashok.83
4 Replies

5. Shell Programming and Scripting

Extract a substring.

I have a shell script that uses wget to grab a bunch of html from a url. URL_DATA=`wget -qO - "$URL1"` I now have a string $URL_DATA that I need to pull a substring out of..say I had the following in my string <p><a href="/scooby/929011567.html">Dog pictures check them out! -</a><font... (3 Replies)
Discussion started by: shellpower
3 Replies

6. Solaris

Extract substring from a string

i have srtring i.e. "NAME,CLASS,AGE" (length of string is not constant) and from this string i've extract each word delimited by "," (comma). INPUT: "NAME,CLASS,AGE" OUTPUT: NAME CLASS AGE how can i do that? i have tried some string manipulation function like... (5 Replies)
Discussion started by: jadoo_c2
5 Replies

7. Shell Programming and Scripting

How to extract a substring from a string

Hi, I have an input string say for example: ABC,DEF,IJK,LMN,...,XYZ The above string is comma delimited. Now I have to extract the last part after the comma i.e. XYZ. :b: (3 Replies)
Discussion started by: bghosh
3 Replies

8. Shell Programming and Scripting

Extract substring in a file

Hello, A question please. A have a file that contains a string. Ex: AAAABBCCCCCDDEEEEEEEEEEFF I'd want to recover 2 substrings, 'BB' and 'FF' and then leave them in a new file. Could anoyone help me please? Thanks in advance (3 Replies)
Discussion started by: nolo41
3 Replies

9. Shell Programming and Scripting

Extract a substring from a file

Hello, A question please. A have a file that contains a string. Ex: AAAABBCCCCCDDEEEEEEEEEEFF I'd want to recover 2 substrings, 'BB' and 'FF' and then leave them in a new file. From position 5, 2 caracters (ex:"BB") and from position 25, 2 caracters (ex:"FF") in a file. Could anoyone help me... (3 Replies)
Discussion started by: nolo41
3 Replies

10. Shell Programming and Scripting

Script Shell Extract substring

Hi all, Please, i'd like to extract string just before '.fr'. Here is some lines of my file: g-82.text.text1.fr.worker1 g-xx.yyyyyy.zzzz.fr.worker2 i'd like to extract this text: g-82.text.text1 g-xx.yyyyyy.zzzz Please, which command i have to use in my script shell ? ... (16 Replies)
Discussion started by: chercheur111
16 Replies
oss_imux(7)							    OSS Devices 						       oss_imux(7)

NAME
oss_imux - Input Muplexer audio driver. DESCRIPTION
IMUX is a virtual recording engine that permits up to 8 audio recording applications to run at the same time. Generally most soundcards permit only a single recording application to record the input source (via mic, line or CD). With IMUX, you can use up to 8 recording applications to record the same source in different sample rates, bits/sample and channels (mono/stereo). IMUX does all the rate and for- mat conversion in software. The applications think that they are actually getting data from the physical device. For instance, if you want to record the input from a CDROM in .wav format at 48Khz/8/Mono and at the same time you want to record the same stream in .mp3 format in 44.1Khz 16 bit stereo, with IMUX, you can start the wave recording application on the first IMUX device and start the MP3 encoder on the second IMUX device and both applications will run simultaneously thinking that they are getting data from the physical soundcard. CONFIGURATION
To add the IMUX driver you first need to ensure that there is a physical soundcard present and then you can run ossdetect -i to add it. You may want to select a master device by setting imux_masterdev, but the autodetection should provide a good default. After OSS restart, imux should be available. USAGE
Connect an input source to the soundcard's line-in jack. Using the Mixer app like ossmix (or any OSS compliant mixer) set the recording source to Line-In (eg ossmix line.rec ON) Now you can start recording the input in multiple formats and at different sample rates. The sim- plest example is: ossrecord -s48000 -b16 -c2 -d/dev/oss/oss_imux0/pcmin0 test1.wav & ossrecord -s8000 -b8 -d/dev/oss/oss_imux0/pcmin0 test2.wav & After a few minutes of recording you can stop them by placing the command in forground mode (type fg %1 or fg %2) and press ^c to stop. You now have two wav format files. test1.wav is a 48KHz 16bit stereo file and test2.wav is a 8Khz 8bit Mono file. You can now playback the files as follows: o ossplay -v test1.wav and it should show you that the file is indeed 48Khz 16bit stereo. o ossplay -v test2.wav - you should see that this file is indeed a 8Khz 8bit mono file. What you have essentially accomplished is recording a single input stream into two different formats at the same time. You can now extend this analogy to record the input in mp3 format and RealAudio format simultaneously. The IMUX control panel can be displayed by typing ossxmix -d<imux mixer number> (for e.g. in the above example, IMUX mixer is #2 so we type ossxmix -d2 There are record level control sliders for each input channel and it will show activity when a recording program is active on a particular channel. OPTIONS
o imux_masterdev: Selects which physical device to use as the Master device for the IMUX driver. Values: -1: automatically selected by OSS, 1-N: Audio device index of the master device (as reported by ossinfo -a), Default: -1. o imux_rate: Specifies what is the base sampling rate used by the imux driver. Values: 5000-96000 Default: 48000 o imux_devices: Specifies number of Input Multiplexer devices to setup. Values: 2-48 Default: 5 FILES
/etc/oss4/conf/oss_imux.conf Device configuration file AUTHOR
4Front Technologies 16 December 2012 oss_imux(7)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy