Sponsored Content
Full Discussion: Issues in sed command
Top Forums Shell Programming and Scripting Issues in sed command Post 302882797 by pandeesh on Thursday 9th of January 2014 07:54:42 AM
Old 01-09-2014
Quote:
Originally Posted by MadeInGermany
Code:
man sed

sais that -i option modifies the input file.
But here the input is a stream!
Try withou -i ...

---------- Post updated at 05:23 AM ---------- Previous update was at 05:15 AM ----------

Just seeing that the first sed also gets arguments (from the sub command in backticks) that can be modified. I am not sure how this combination is handled...
And your error is a "vim" error, so it seems that this does not work at all.
Maybe you should write a "vim" macro instead!
Trying without "-i" won't save the changes in the /tmp/tmp.* file, which is required in my case. i am exploring -s option in ed as ctsgnb suggested.

Thanks

---------- Post updated at 06:24 PM ---------- Previous update was at 05:45 PM ----------

I have tried something like below, but still it doesn't work as expected:
Code:
 function submit
{
  submit 2>&1 &
  filename=`ls -rt /tmp/tmp.*|sed -n '1p'`
  ed -- ${filename}  <<-HERE
  24s!<enter description here>!$1!
  w
  q
HERE
}

The first submit command opens vi terminal with some text . In which i need to enter the description and save it. This is what i want to accomplish, but getting the below errors:

Code:
desktop% submit test
[20] 32522
933
?
desktop%
[20]  + suspended (tty output)

Any thoughts on this?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed issues with strange char

Hi all, I try to create a shell script to had the xiti tag at the end of servals web pages just before the <body/> tag. here is my script : #!/bin/bash ################################################################## rm -R /home/hibern/TEMP/hibern cp -R... (5 Replies)
Discussion started by: hibern
5 Replies

2. Shell Programming and Scripting

sed issues

Hi guys, not that used to using sed beyond the simple substitution. I am trying to check for a program (program1) and if it exists replace the standard output "program1" with a "program1(part1 part2) output if said program exists. SW="program1 program2" PROGRAM_TEST='echo "$SW" | grep... (3 Replies)
Discussion started by: mikepegg
3 Replies

3. Shell Programming and Scripting

sed edit in place -i issues

Hello, I am attempting to create a command that I can eventually put into a loop so I can edit 1file on many servers. I would like to edit the file in place with sed -i. If not I will take any suggestions on how to use a temp file. I need to remove a email address from the configuration file... (4 Replies)
Discussion started by: abacus
4 Replies

4. Shell Programming and Scripting

Filtering Issues Using sed and awk

Hi, I am currently using the sed and awk commands to filter a file that has multiple sets of data in different columns. An example of part of the file i am filtering is as follows; Sat Oct 2 07:42:45 2010 01:33:46 R1_CAR_12.34 Sun Oct 3 13:09:53 2010 00:02:34 R2_BUS_56.78 Sun... (4 Replies)
Discussion started by: crunchie
4 Replies

5. Shell Programming and Scripting

sed pattern and hold space issues

Good day. Trying to make a sed script to take text file in a certain format and turn it into mostly formatted html. I'm 95% there but this last bit is hurting my head finally. Here's a portion of the text- Budgeting and Debt: Consumer Credit Counseling of Western PA CareerLink 112... (5 Replies)
Discussion started by: fiendracer
5 Replies

6. Homework & Coursework Questions

sed & cut command issues

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: After using the egrep command to pull certain lines from the asg5f1 (creating the asg5f1c file), I am required... (1 Reply)
Discussion started by: robrom78
1 Replies

7. Shell Programming and Scripting

Issues with sed on SunOS

Why does the below command doesnt work fine on SunOS 5.10 $ cat t | AK| | | | | DS | | | | tAR | | | | | FIL | $ sed -e 's/^ *//g' -e 's/ *$//g' -e 's/ *| */|/g' t |AK|||||DS|||| tAR|||||FIL| ##notice before tAR works fine on Linux OR AIX though ... (8 Replies)
Discussion started by: Shivdatta
8 Replies

8. Shell Programming and Scripting

sed special characters issues

I am dusting off the sed cobwebs and had a basic question: I have a file that contains: $firewall = "on"; $cache = "on"; $dataset{'mary had a little lamb'} = "on"; and want to only change the contents of what is between the single quotes: $dataset{'big bad wolf'} = "on"; I... (3 Replies)
Discussion started by: metallica1973
3 Replies

9. Shell Programming and Scripting

Sed: removes \ from text which causes issues

Hi all, Hoping someone hoping someone might be able to help. i've got the following sed command which i'm using in a bash script that i'm trying to use to insert a new line into an already existing file so i don't have to manually enter it when setting stuff up. the existing script test2/3 are... (3 Replies)
Discussion started by: springs2
3 Replies

10. Shell Programming and Scripting

Issues with using sed with word delimiters \< and \>

sed is not applying /d "delete line" option when I also include match word options \< and \> examples... echo cat | sed '/\<cat\>/d' will return cat for some reason echo cat | sed "/\<cat\>/d" will also still return cat. Of course I can just run this... echo cat | sed '/cat/d' and... (1 Reply)
Discussion started by: escooter87
1 Replies
GRUB-FILE(1)                                                       User Commands                                                      GRUB-FILE(1)

NAME
grub-file - check file type SYNOPSIS
file OPTIONS FILE DESCRIPTION
Check if FILE is of specified type. --is-i386-xen-pae-domu Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel --is-x86_64-xen-domu Check if FILE can be booted as x86_64 Xen unprivileged guest kernel --is-x86-xen-dom0 Check if FILE can be used as Xen x86 privileged guest kernel --is-x86-multiboot Check if FILE can be used as x86 multiboot kernel --is-x86-multiboot2 Check if FILE can be used as x86 multiboot2 kernel --is-arm-linux Check if FILE is ARM Linux --is-arm64-linux Check if FILE is ARM64 Linux --is-ia64-linux Check if FILE is IA64 Linux --is-mips-linux Check if FILE is MIPS Linux --is-mipsel-linux Check if FILE is MIPSEL Linux --is-sparc64-linux Check if FILE is SPARC64 Linux --is-powerpc-linux Check if FILE is POWERPC Linux --is-x86-linux Check if FILE is x86 Linux --is-x86-linux32 Check if FILE is x86 Linux supporting 32-bit protocol --is-x86-kfreebsd Check if FILE is x86 kFreeBSD --is-i386-kfreebsd Check if FILE is i386 kFreeBSD --is-x86_64-kfreebsd Check if FILE is x86_64 kFreeBSD --is-x86-knetbsd Check if FILE is x86 kNetBSD --is-i386-knetbsd Check if FILE is i386 kNetBSD --is-x86_64-knetbsd Check if FILE is x86_64 kNetBSD --is-i386-efi Check if FILE is i386 EFI file --is-x86_64-efi Check if FILE is x86_64 EFI file --is-ia64-efi Check if FILE is IA64 EFI file --is-arm64-efi Check if FILE is ARM64 EFI file --is-arm-efi Check if FILE is ARM EFI file --is-hibernated-hiberfil Check if FILE is hiberfil.sys in hibernated state --is-x86_64-xnu Check if FILE is x86_64 XNU (Mac OS X kernel) --is-i386-xnu Check if FILE is i386 XNU (Mac OS X kernel) --is-xnu-hibr Check if FILE is XNU (Mac OS X kernel) hibernated image --is-x86-bios-bootsector Check if FILE is BIOS bootsector -h, --help Display this help and exit. -u, --usage Display the usage of this command and exit. SEE ALSO
The full documentation for grub-file is maintained as a Texinfo manual. If the info and grub-file programs are properly installed at your site, the command info grub-file should give you access to the complete manual. grub-file (GRUB) 2.02-2ubuntu8.3 July 2018 GRUB-FILE(1)
All times are GMT -4. The time now is 01:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy