Sponsored Content
Full Discussion: Running Sed on a file.
Top Forums Shell Programming and Scripting Running Sed on a file. Post 302118383 by cfajohnson on Monday 21st of May 2007 05:33:22 PM
Old 05-21-2007
Quote:
Originally Posted by Paulw0t
I'm taking in an arguement thats sorted in $file.

The $file contains a file name like file1.txt or something all files are in the same directory as the script..

Can I run sed on the file ? I was thinking of using something like

more file.txt | sed "s/http//"

Something like that is there a way to output the contents of the file and pipe it into sed ?

You don't need more. Just append the names of one or more files after the command:

Code:
sed "s/http//" file.txt file2.txt file3.txt

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

running sed inside script file

i am substituting some text in the xml file using sed, on shell directly it works fine, but when i run it inside script file, it say, the function cant be parsed, i think the prob is due to xml file, kindly help (4 Replies)
Discussion started by: bajaj111
4 Replies

2. Shell Programming and Scripting

sed command not running

I am using solrais 10 on sun sparc. The following command executes successfully echo c:/test.txt | sed -e 's/\//\\\//g' But when i executes the following command x=`echo c:/test.txt | sed -e 's/\//\\\//g'` I get the following error sed: command garbled: s/\//\\//g Is there any way to avoid... (3 Replies)
Discussion started by: mmunir
3 Replies

3. Shell Programming and Scripting

sed over writes my original file (using sed to remove leading spaces)

Hello and thx for reading this I'm using sed to remove only the leading spaces in a file bash-280R# cat foofile some text some text some text some text some text bash-280R# bash-280R# sed 's/^ *//' foofile > foofile.use bash-280R# cat foofile.use some text some text some text... (6 Replies)
Discussion started by: laser
6 Replies

4. Shell Programming and Scripting

Running sed commands

Hello I need to run some sed commands but it involves "/" in the substitute or delete, any ideas how I get round the problem. Example: cat file1.txt | sed -e '/</Header>/d' > file2.txt This errors due to the forward slash before the Header text. Thanks (3 Replies)
Discussion started by: Dolph
3 Replies

5. Shell Programming and Scripting

how to make my own file as a running log file in bash

Hi, I have written a small script from that iam appending the output to a file.If multiple users invoke the same script or if i invoke the same script n number of times (using &), the output file(ZZ/OUT) contains messup information. #!/bin/bash # echo "Hello" >> /tmp/ZZ/OUT sleep 10 echo... (4 Replies)
Discussion started by: blrguest
4 Replies

6. Shell Programming and Scripting

Making use of multiple cores for running sed and awk scripts

Hi All, After reading that the sort command in Linux can be made to use many processor cores just by using a simple script which I found on the internet, I was wondering if I can use similar techniques for programs like the awk and sed? #!/bin/bash # Usage: psort filename <chunksize>... (7 Replies)
Discussion started by: shoaibjameel123
7 Replies

7. Shell Programming and Scripting

Running sed and counting number of lines processed

/bin/sed -n ';4757335,$ p' | wc -l /bin/sed -n ';4757335,$ p' | egrep "Failed" | egrep -c "PM late arrrival" how can i combine the above two sed commands into one? i want to count the number of lines between the specified line number and the end of the file. AND and i want to count how many... (5 Replies)
Discussion started by: SkySmart
5 Replies

8. Shell Programming and Scripting

Issue with SUNOS running sed scripts

Hi I probably dont have GNU extended sed in my SUNOS . and its creating lot of problems ex: a simple sed command like this is not working sed '/WORD/ a\ sample text line 1 \ sample text line 1 ' filename sed: command garbled: /WORD/ a I took precaution to have a new line after... (11 Replies)
Discussion started by: vash
11 Replies

9. Shell Programming and Scripting

Running sed from a script query

Hello! I'm trying to run this code to print the body of an html document (all text in between <body> and </body>) from a script but am unsure how to call it from the command line interface. /<body>/,/<\/body>/ 1s/.*<body>// $s/<\/body>.*//p I have tried to call it using this: sed... (6 Replies)
Discussion started by: bgnersoon2be#1
6 Replies

10. Shell Programming and Scripting

GNU sed running on Mac

Super basic question. I installed sed GNU on a MAC running High Sierra. However, when I run sed '1i>sometext, I get the following error: sed: 1: "1isometext"; command i expects \ followed by text I have added the \ with no success. Is there anyway I can run sed and awk on MAC in the... (5 Replies)
Discussion started by: Xterra
5 Replies
X2SYS_MERGE(1gmt)					       Generic Mapping Tools						 X2SYS_MERGE(1gmt)

NAME
x2sys_merge - Merge an updated COEs tables SYNOPSIS
x2sys_merge -Amain_COElist.d -Mnew_COElist.d DESCRIPTION
x2sys_merge will read two crossovers data base and output the contents of the main one updated with the COEs in the second one. The second file should only contain updated COEs relatively to the first one. That is, it MUST NOT contain any new two tracks intersections (This point is NOT checked in the code). This program is useful when, for any good reason like file editing NAV correction or whatever, one had to recompute only the COEs between the edited files and the rest of the database. -A Specify the file main_COElist.d with the main crossover error data base. -M Specify the file new_COElist.d with the newly computed crossover error data base. OPTIONS
No space between the option flag and the associated arguments. EXAMPLES To update the main COE_data.txt with the new COEs estimations saved in the smaller COE_fresh.txt, try x2sys_merge -ACOE_data.txt -MCOE_fresh.txt > COE_updated.txt SEE ALSO
x2sys_binlist(1), x2sys_cross(1), x2sys_datalist(1), x2sys_get(1), x2sys_init(1), x2sys_list(1), x2sys_put(1), x2sys_report(1) GMT 4.5.7 15 Jul 2011 X2SYS_MERGE(1gmt)
All times are GMT -4. The time now is 06:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy