Sponsored Content
Full Discussion: Help with Sed
Top Forums Shell Programming and Scripting Help with Sed Post 302121490 by Shell_Life on Friday 15th of June 2007 01:33:22 PM
Old 06-15-2007
Code:
sed -n '/18:/,$ p' filename

-n --> Displays only those lines specified by the "p" command.
/18:/,$ --> Range of lines from pattern "18:" to end of file "$".
p --> Print
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed Question 1. (Don't quite know how to use sed! Thanks)

Write a sed script to extract the year, rank, and stock for the most recent 10 years available in the file top10_mktval.csv, and output in the following format: ------------------------------ YEAR |RANK| STOCK ------------------------------ 2007 | 1 | Exxon... (1 Reply)
Discussion started by: beibeiatNY
1 Replies

2. Shell Programming and Scripting

Issue with a sed one liner variant - sed 's/ ; /|/g' $TMP1 > $TMP

Execution of the following segment is giving the error - Script extract:- OUT=$DATADIR/sol_rsult_orphn.bcp TMP1=${OUT}_tmp1 TMP=${OUT}_tmp ( isql -w 400 $dbConnect_OPR <<EOF select convert(char(10), s.lead_id) +'|' + s.pho_loc_type, ";", s.sol_rsult_cmnt, ";", +'|'+ s.del_ind... (3 Replies)
Discussion started by: kzmatam
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

sed has zeored my files. Help me with sed please

i made a script to update a lot of xml files. to save me some time. Ran it and it replaced all the the files with a 0kb file. The problem i was having is that I am using sed to change xml node <doc_root>. The problem with this is it has a / in the closing xml tag and the stuff inside will also have... (4 Replies)
Discussion started by: timgolding
4 Replies

5. Shell Programming and Scripting

deleting text records with sed (sed paragraphs)

Hi all, First off, Thank you all for the knowledge I have gleaned from this site! Deleting Records from a text file... sed paragraphs The following code works nearly perfect, however each time it is run on the log file it adds a newline at the head of the file, run it 5 times, it'll have 5... (1 Reply)
Discussion started by: Festus Hagen
1 Replies

6. UNIX for Dummies Questions & Answers

SED: Can't Repeat Search Character in SED Output

I'm not sure if the problem I'm seeing is an artifact of sed or simply a beginner's mistake. Here's the problem: I want to add a zero-width space following each underscore between XML tags. For example, if I had the following xml: <MY_BIG_TAG>This_is_a_test</MY_BIG_TAG> It should look like... (8 Replies)
Discussion started by: rhetoric101
8 Replies

7. Shell Programming and Scripting

How to use sed to replace the a string in the same file using sed?

How do i replace a string using sed into the same file without creating a intermediate file? (7 Replies)
Discussion started by: gomes1333
7 Replies

8. Shell Programming and Scripting

sed inside sed for replacing string

My need is : Want to change docBase="/something/something/something" to docBase="/only/this/path/for/all/files" I have some (about 250 files)xml files. In FileOne it contains <Context path="/PPP" displayName="PPP" docBase="/home/me/documents" reloadable="true" crossContext="true">... (1 Reply)
Discussion started by: linuxadmin
1 Replies

9. 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

10. Shell Programming and Scripting

I am learning regular expression in sed,Please help me understand the use curly bracket in sed,

I am learning SED and just following the shell scripting book, i have trouble understanding the grep and sed statement, Question : 1 __________ /opt/oracle/work/antony>cat teledir.txt jai sharma 25853670 chanchal singhvi 9831545629 anil aggarwal 9830263298 shyam saksena 23217847 lalit... (7 Replies)
Discussion started by: Antony Ankrose
7 Replies
advscan(8)						      System Manager's Manual							advscan(8)

NAME
advscan - Locates AdvFS volumes on disk devices SYNOPSIS
/sbin/advfs/advscan [-g] [-a] [-r] [-f domain_name] devices... disk_group... OPTIONS
Scans all devices found in any /etc/fdmns domain as well as those in the command line. Fixes the domain count and the links in the /etc/fdmns directory for the named domain. Lists the AdvFS volumes in the order they are found on each disk device or Logical Storage Man- ager (LSM) disk group. Re-creates missing domains. The domain name is created from the device names or LSM disk group names. OPERANDS
Specifies the device names of disks to scan for AdvFS volumes. Specifies the LSM disk groups to scan for AdvFS volumes. DESCRIPTION
The advscan command locates AdvFS volumes (disk partitions or LSM volumes) that are in AdvFS domains. Given the AdvFS volumes, you can re-create or fix the /etc/fdmns directory of a named domain or LSM disk group. For example, if you have moved disks to a new system, moved disks around in a way that has changed device numbers, or lost track of where the AdvFS domains are, you can use this command to locate them. Another use of the advscan command is to repair AdvFS domains when you have broken them. For example, if you mistakenly delete the /etc/fdmns directory, delete a domain directory in the /etc/fdmns directory, or delete links from a domain directory under the /etc/fdmns directory, you can use the advscan command to fix the problem. The advscan command accepts a list of disk device names and/or LSM disk group names and searches all the disk partitions to determine which partitions are part of an AdvFS domain. You can run the advscan command to automatically rebuild all or part of your /etc/fdmns directory or you can rebuild it manually by supply- ing all the names of the AdvFS volumes in a domain. If the -g option is not set, the AdvFS volumes are listed as they are grouped in domains. Set this option to list the AdvFS volumes in the order they are found on each disk. Run the advscan command with the -r option set to re-create missing domains from the /etc/fdmns directory, missing links, or the entire /etc/fdmns directory. Although the advscan command will rebuild the /etc/fdmns directory automatically, Compaq recommends that you always keep a hard-copy record of the current /etc/fdmns directory. To determine if a disk partition is part of an AdvFS domain, the advscan command performs the following functions: Reads the first two pages of a partition to determine if it is an AdvFS volume and to find the domain information. Reads the disk label to sort out overlap- ping partitions. The size of overlapping partitions are examined and compared to the domain information to determine which partitions are in the domain. These partitions are reported in the output. Reads the boot block to determine if the partition is AdvFS root bootable. The advscan command displays the date the domain was created, the on-disk structure version, and the last known or current state of the volume. In order to mount an AdvFS fileset, the domain that contains the fileset must be consistent. An AdvFS domain is consistent when the number of physical partitions or volumes with the correct domain ID are equal to both the domain volume count (which is a number stored in the domain) and the number of links to the partitions that are in the /etc/fdmns directory. Domain inconsistencies can occur in diverse ways. Use the -f option to correct domain inconsistencies. If you attempt to mount an inconsistent domain, a message similar to the following will appear on the console: # Volume count mismatch for domain dmnz. dmnz expects 2 volumes, /etc/fdmns/dmnz has 1 links. RESTRICTIONS
You must be the root user to use this command. EXAMPLES
The following are examples of the output from the advscan command. The following example scans devices dsk3 and diskgroup rootdg for AdvFS partitions: # advscan dsk3 rootdg Scanning devices /dev/rdisk/dskz3 rootdg Found domains: usr_domain Domain Id 30a91a42.0001e060 Created Thu Mar 16 14:37:54 2000 Domain volumes 2 /etc/fdmns links 2 Actual partitions found: rz3g rootdg.vol03 The following example scans devices found in /etc/fdmns. It uses the -g option to list parti- tions in the order they are found on the disks rather than grouping them into domains and matching them with the /etc/fdmns directory. # advscan -a -g scanning disks /dev/rdisk/dsk2 /dev/rdisk/dsk3 rootdg Partition Domain Id /dev/dsk2a 30a919ff.000ec470 V3, mounted, bootable 1 volume in domain Created Mon Jan 11 14:36:47 1999 Last mount Fri Jun 30 16:00:04 2000 /dev/dsk2g 30a91a32.0007c250 V4, mounted 1 volume in domain Created Thu Mar 16 14:37:38 2000 Last mount Fri Mar 24 17:14:16 2000 /dev/dsk3a 30abe160.00028eff V3, never mounted 1 volume in domain Created Thu Mar 18 17:12:00 1999 /dev/dsk3g 30a91a42.0001e060 V3, mounted 1 volume in domain Created Tue Mar 16 14:37:54 1999 Last mount Thu Mar 23 17:14:17 2000 rootdg.vol01 30c62c74.00036750 V4, dismounted 2 volumes in domain Created Fri Apr 7 15:51:16 2000 Last mount Fri Apr 7 17:16:06 2000 rootdg.vol02 30c62c74.00036750 V3, dismounted Created Wed Apr 7 15:51:16 1999 Last mount Wed Apr 7 17:16:06 1999 For the following example, two domains using device dsk3 and disk group rootdg were removed from the /etc/fdmns directory. The advscan command scans device dsk3 and disk group rootdg and then re-creates the missing domains. # advscan -r dsk3 rootdg Scanning disks /dev/disk/dsk3 /dev/rvol/rootdg Found domains: *unknown* Domain Id 30a91a42.0001e060 Created Tue Mar 16 14:37:54 2000 Domain volumes 1 /etc/fdmns links 0 Actual partitions found: dsk3g* *unknown* Domain Id 30c62c74.00036750 Created Wed Apr 7 15:51:16 2000 Domain volumes 2 /etc/fdmns links 0 Actual partitions found: rootdg.vol01* rootdg.vol02* Creating /etc/fdmns/domain_dsk3g/ linking dsk3g Creating /etc/fdmns/domain_rootdg.vol01_rootdg.vol02/ linking rootdg.vol01 linking rootdg.vol02 FILES
SEE ALSO
Commands: disklabel(8) Files: fstab(4) advscan(8)
All times are GMT -4. The time now is 04:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy