Sponsored Content
Top Forums Shell Programming and Scripting Conditional search and delete using SED / Shell script Post 302583208 by Ygor on Tuesday 20th of December 2011 01:11:56 AM
Old 12-20-2011
Try...
Code:
echo "abcdaabcadgfaarstab" | sed 's/\(^\|[^a]\)a\([^a]\|$\)/\1\2/g'

This User Gave Thanks to Ygor For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script to search a string and delete the content

Hi, I've a shell script e.g. #!/bin/bash echo "Enter the next hop id" read nhid echo "enter the IP address" read IP echo "enter the interface name" read name echo "enter the enable/disable state" read state exit 0 now from this script i want to search strings in another (.cam) ... (6 Replies)
Discussion started by: vic_mnnit
6 Replies

2. Shell Programming and Scripting

Help with search and delete/add/modify script

Gurus, I need to run a script on multiple XML files in different directories and do the following (the output can be redirected to create a new file) 1. Search a pattern like "abc.mno.xyz" in an XML file, once detected, the script should delete one line above and 3 lines below (including the... (2 Replies)
Discussion started by: inditopgun
2 Replies

3. Shell Programming and Scripting

Help on shell script conditional execution when CPU Idle > 60%

I need a shell script that will monitor a few conditions and not execute until the these conditions are met. The problem I'm having is that I can not perform a database snapshot (backup) of a sybaseIQ database unless the CPU Status Idle % is above 60% or the snapshot (backup) fails. If... (2 Replies)
Discussion started by: pancona99
2 Replies

4. Shell Programming and Scripting

search and conditional execution

Hi, I have a list of files with different filenames like nam0001.txt,pan0001.txt etc coming in /data/inbox from various places. I needed a shell script which would:- 1)searches for a word from the filenames (coming in inbox directory) provided in input parameter. 2)if found, put in... (2 Replies)
Discussion started by: Saiesh
2 Replies

5. Shell Programming and Scripting

sed search pattern and delete lines

Hello, i have a question. My problem is that i have a file like: TEST JOHN ADAM MICHAEL SEBASTIAN ANDY i want find for MICHAEL and want delete lines like this: TEST (4 Replies)
Discussion started by: eightball
4 Replies

6. Shell Programming and Scripting

Conditional Search/Replace

I'm looking for an awk or (preferably) sed solution to search a pipe delimited file for any occurrence of an email address that does not include a designed domain, and replace the email address with a blank. E.g. hello|smith@designateddomain.com|jones@anotherdomain.edu|1234| turns into: ... (2 Replies)
Discussion started by: tiggyboo
2 Replies

7. Homework & Coursework Questions

sed Multiple Pattern search and delete the line

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: I have file which has got the following content sam 123 LD 41 sam 234 kp sam LD 41 kam pu sam LD 61 Now... (1 Reply)
Discussion started by: muchyog
1 Replies

8. Shell Programming and Scripting

Conditional string search

Hi, I need to search/grep userid and its value based on a condition that the user id is under the heading "*central_test*" in a big file of about 70808MB. The * represents some strings before and after the string "centrla_test". Could anyone please guide. OS is hp-ux. (2 Replies)
Discussion started by: sam_bd
2 Replies

9. Shell Programming and Scripting

Conditional delete

Hi Friends, I have somefiles like 20180720_1812.tar.gz 20180720_1912.tar.gz 20180720_2012.tar.gz 20180720_2112.tar.gz 20180721_0012.tar.gz 20180721_0112.tar.gz 20180721_0212.tar.gz 20180721_0312.tar.gz in a directory and so on..these files gets created every 3 hours where as... (28 Replies)
Discussion started by: onenessboy
28 Replies

10. Shell Programming and Scripting

Conditional delete -- New glitch

Hi Please dont consider this as duplicated post.. I am using below pattern to find delete files to bringdown disc size.. however how i can make sure ist going to correct folder and searching for files... while print "echo rm " LastFile correctly print files names for deletion, but when i... (7 Replies)
Discussion started by: onenessboy
7 Replies
search.h(3HEAD)                                                       Headers                                                      search.h(3HEAD)

NAME
search.h, search - search tables SYNOPSIS
#include <search.h> DESCRIPTION
The <search.h> header defines the ENTRY type for structure entry, which includes the following members: char *key void *data and defines ACTION and VISIT as enumeration data types through type definitions as follows: enum { FIND, ENTER } ACTION; enum { preorder, postorder, endorder, leaf } VISIT; The size_t type is defined as described in <sys/types.h>. See types.h(3HEAD). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
hsearch(3C), insque(3C), lsearch(3C), tsearch(3C), types.h(3HEAD), attributes(5), standards(5) SunOS 5.10 10 Sep 2004 search.h(3HEAD)
All times are GMT -4. The time now is 09:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy