Sponsored Content
Full Discussion: ls fed into sed help
Top Forums UNIX for Dummies Questions & Answers ls fed into sed help Post 302574112 by varathaneie on Wednesday 16th of November 2011 01:22:10 PM
Old 11-16-2011
try this....

if u want to work with all the files in the current directory, you may to use a looping structure,
Code:
ls > ./list.txt
while read line
do
  sed "/#Text_to_be_deleted/d" $line >tmp
  mv tmp $line
done < ./list.txt
rm ./list.txt

Moderator's Comments:
Mod Comment How to use code tags

Last edited by Franklin52; 11-17-2011 at 05:39 AM.. Reason: Please use code tags, thanks
 

6 More Discussions You Might Find Interesting

1. Cybersecurity

Fed up of Viruses

I am fed up of getting viruses on my computer. They come from other computers on the network and I'm fed up with them. Can anyone reccomend some virus scanning software or something that I can use to prevent my machine from getting viruses? Thanks (3 Replies)
Discussion started by: jacx2
3 Replies

2. UNIX for Dummies Questions & Answers

read user input from within a wile loop that is being fed from below

hi! i need to do a ksh script that uses a wile loop that is fed form below while read line do some things done < myfile inside the while loop i need to read user input to ask the user what he wants to do, but "read" reads the file, and not the standard input while read line do ... (2 Replies)
Discussion started by: broli
2 Replies

3. Red Hat

Help reqd in installing wireless usb on fed 14

Hello all, I am fed up on trying to install my newly purchased usb wireless antenna to my fedora14 machine; so I seek help of all you linux masterminds out there. It worked well in my Win XP. Please help me in setting up it to my Fedora. . Details follows: The device model is : Aztech... (5 Replies)
Discussion started by: gsabarinath
5 Replies

4. UNIX for Dummies Questions & Answers

[ksh93+] Array fed by function is empty when used in main.

I feel that i am missing something obvious but i can't find what is wrong. I have a script that is launching some functions with "&" and each call is feeding the array with a value. When all calls are finished I just want to retrieve the values of that array. It is looking like that : ... (5 Replies)
Discussion started by: bibou25
5 Replies

5. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies

6. Solaris

Replace critical files with errors - pam_UNIX_auth.so.1 & fed

I moved my server while it was running. I was in a hurry. Also it's a bare motherboard with drives in a cage sitting basically on their own. Once I realized how badly I had hurt it doing this, I mounted the board in a tower case I repurposed, mounted the drives, power supply etc. Now the... (1 Reply)
Discussion started by: BillyPrefect
1 Replies
SHTOOL-SUBST.TMP(1)					      GNU Portable Shell Tool					       SHTOOL-SUBST.TMP(1)

NAME
shtool-subst - GNU shtool sed(1) substitution operations SYNOPSIS
shtool subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ext] [-e|--exec cmd] [-f|--file cmd-file] [file] [file ...] DESCRIPTION
This command applies one or more sed(1) substitution operations to stdin or any number of files. OPTIONS
The following command line options are available. -v, --verbose Display some processing information. -t, --trace Enable the output of the essential shell commands which are executed. -n, --nop No operation mode. Actual execution of the essential shell commands which would be executed is suppressed. -w, --warning Show warning on substitution operation resulting in no content change on every file. The default is to show a warning on substitution operations resulted in no content change on all files. -q, --quiet Suppress warning on substitution operation resulting in no content change. -s, --stealth Stealth operation. Preserve timestamp on file. -i, --interactive Enter interactive mode where the user has to approve each operation. -b, --backup ext Preserve backup of original file using file name extension ext. Default is to overwrite the original file. -e, --exec cmd Specify sed(1) command directly. -f, --file cmd-file Read sed(1) command from file. EXAMPLE
# shell script shtool subst -i -e 's;(c) ([0-9]*)-2000;(c) 1-2001;' *.[ch] # RPM spec-file %install shtool subst -v -n -e 's;^(prefix=).*;1 $RPM_BUILD_ROOT%{_prefix};g' -e 's;^(sysconfdir=).*;1 $RPM_BUILD_ROOT%{_prefix}/etc;g' `find . -name Makefile -print` make install HISTORY
The GNU shtool subst command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 2001 for GNU shtool. It was prompted by the need to have a uniform and convenient patching frontend to sed(1) operations in the OpenPKG package specifications. SEE ALSO
shtool(1), sed(1). 18-Jul-2008 shtool 2.0.8 SHTOOL-SUBST.TMP(1)
All times are GMT -4. The time now is 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy