Sponsored Content
Top Forums Shell Programming and Scripting Help needed with shell script to search and replace a set of strings among the set of files Post 302890313 by SriniShoo on Wednesday 26th of February 2014 06:57:45 AM
Old 02-26-2014
Code:
#!/bin/ksh
cat sync.log | while read line
do
F_EXT=${line##*.}
if [[ ${F_EXT} == "html" || ${F_EXT} == "htm" || ${F_EXT} == "css" || ${F_EXT} == "js" ]]; then
# sed -i 's/abc/test1/g;efg/test2/g;gfdg/test3/g' ${line}
perl -i -pe 's/abc/test1/g;' -pe 's/efg/test2/g;' -pe 's/gfdg/test3/g;' ${line}
fi
done

This User Gave Thanks to SriniShoo For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

set password using a shell script

Hi All How can I set password in linux.It is OK if it display password in plain text in script. manually i can set: #passwd Changing password for root Enter new password: Bad password: too weak. Re-enter new password: Password changed. # I want this to be done by script.Please let me... (2 Replies)
Discussion started by: tannu
2 Replies

2. Shell Programming and Scripting

Ksh script - Design ? - Search file and set variables

Hi - I'm trying to think of a clever way to write a shell script (trying to stay w/ ksh as that's what I know the best...) that will resolve the following problem: Problem - On a daily basis I have to email folks who are on-call to remind them. I was hoping to script this out so I could have... (9 Replies)
Discussion started by: littlefrog
9 Replies

3. UNIX for Dummies Questions & Answers

vi search/replace using a set

Hi, I'm trying to do a global search/replace in vi using a set - I want to find every occurance of a carriage return followed by a character and replace it with a space. I've tried the following: :%s/\n/ /g It does the search ok, but it replaces the characters with the literal value ""... (2 Replies)
Discussion started by: HudZo
2 Replies

4. Shell Programming and Scripting

search of common words in set of files

Hi, I have a set of simple, one columned text files (in thousands). file1: a b c d file 2: b c d e and so on. There is a collection of words in another file: b d b c d e I have to find out the set of words (in each row) is present or absent in the given set of files. So, the... (4 Replies)
Discussion started by: mala
4 Replies

5. Shell Programming and Scripting

Complex Search/Replace Multiple Files Script Needed

I have a rather complicated search and replace I need to do among several dozen files and over a hundred occurrences. My site is written in PHP and throughout the old code, you will find things like die("Operation Aborted due to....."); For my new design skins for the site, I need to get... (2 Replies)
Discussion started by: UCCCC
2 Replies

6. UNIX for Dummies Questions & Answers

Loop through Sub Directories and search for set of files

I have the below directory in unix environment /home/bkup/daily: ls -lrt drwxrwx--x 2 user user 256 Jan 12 18:21 20110112/ drwxrwx--x 2 user user 256 Jan 13 17:06 20110113/ drwxrwx--x 2 user user 256 Jan 14 16:44 20110114/ drwxrwx--x 2 user user ... (2 Replies)
Discussion started by: prasannarajesh
2 Replies

7. Shell Programming and Scripting

Finding compound words from a set of files from another set of files

Hi All, I am completely stuck here. I have a set of files (with names A.txt, B.txt until L.txt) which contain words like these: computer random access memory computer networking mouse terminal windows All the files from A.txt to L.txt have the same format i.e. complete words in... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

8. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

9. Shell Programming and Scripting

Search for a value and replace other field in the same set

Hello friends, I have huge file with many sets where each "set" has few lines and each set always begins with "Set" in Sq brackets as shown above. # cat file1 (2 Replies)
Discussion started by: magnus29
2 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 02:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy