Sponsored Content
Top Forums Shell Programming and Scripting Grep command to ignore line starting with hyphen Post 302947568 by Don Cragun on Friday 19th of June 2015 01:36:52 AM
Old 06-19-2015
Quote:
Originally Posted by Srinraj Rao
Thanks for your quick response. My requirement is different.

The file contains text as follows.
Code:
#test
+abc
-xyz
real

The for loop has to read the file line by line and pass the string in each line to the do loop. While reading each line in the file, if the line starts with # or + or - that line should be ignored.

Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, AND code segments.
Is this a homework assignment?

Homework questions must be posted in the homework & coursework questions forum and must include a completely filled out homework template.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

use of hyphen in #! line

In one script i have seen - in #! line can somebody explain the meaning of -(hyphen) here #! /bin/sh - (7 Replies)
Discussion started by: Dhruva
7 Replies

2. Shell Programming and Scripting

add a hyphen every 2 characters of every line

I have a text file like this with hundreds of lines: >cat file1.txt 1027123000 1027124000 1127125000 1128140000 1228143000 > all lines are very similar and have exactly 10 digits. I want to separate the digits by twodigit and hyphens....like so, > 10-27-12-30-00 10-27-12-40-00... (7 Replies)
Discussion started by: ajp7701
7 Replies

3. Shell Programming and Scripting

Grep from a starting line till the end of the file

Hi Folks, I got to know from this forums on how to grep from a particular line say line 6 awk 'NR==6 {print;exit}' But how do i grep from line 6 till the end of the file or command output. Thanks, (3 Replies)
Discussion started by: Mr. Zer0
3 Replies

4. UNIX Desktop Questions & Answers

How to remove text in each line after hyphen?

Hi, I'm trying to do something relatively simple. I have a txt file that has the following kinds of lines (and many more lines): CP19 Oahu - Maunawili Falls CP20 Oahu - Maunawili Falls AG12 Oahu - Maunawili Falls CP22 Oahu - Maunawili Falls, Local area AG14 Oahu CP141 KZ102 Kauai -... (7 Replies)
Discussion started by: euspilapteryx
7 Replies

5. Ubuntu

starting Places->Networks at command line

Hi All I have UBUNTU 10.04 I would like to run at command line the gui application that I use for finding network places and navigate shared folders or network driver. I mean the one located under menu PLACES->NETWORK I tried using "nautilus" but you need to know in advance which IP to give and... (2 Replies)
Discussion started by: manustone
2 Replies

6. Shell Programming and Scripting

Ignore the 255 character limit of command line

Hi I would just like to ask if there is a way for UNIX to ignore/overcome the 255 character limit of the command line? My problem is that I have a really long line of text from a file (300+ bytes) which i have to "echo" and process by adding commands like "sed" to the end of the line, like... (5 Replies)
Discussion started by: agentgrecko
5 Replies

7. UNIX for Dummies Questions & Answers

Grep only line starting with....

Hello, I have a command that show some application information. Now, I have to grep there informations, like: # showlog | grep 1266 1266.1369866124 :: 1266.1304711286 :: 41031.1161812668 :: 41078.1301266480 :: 41641.712662564 :: 1266.333792515 :: 41462.1512661988 :: 1266.54932671... (5 Replies)
Discussion started by: Lord Spectre
5 Replies

8. SCO

Grep to ignore suffix & find end of line

In COBOL, a hyphen can be used in a field name and in a specific program some field names would be identical to others except a suffix was added--sometimes a suffix to a suffix was used. For example, assume I am looking for AAA, AAA-BBB, and AAA-BBB-CCC and don't want to look at AAA-BBB-CCC... (7 Replies)
Discussion started by: wbport
7 Replies

9. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies

10. UNIX for Beginners Questions & Answers

Grep file starting from pattern matching line

I have a file with a list of references towards the end and want to apply a grep for some string. text .... @unnumbered References @sp 1 @paragraphindent 0 2017. @strong{Chalenski, D.A.}; Wang, K.; Tatanova, Maria; Lopez, Jorge L.; Hatchell, P.; Dutta, P.; @strong{Small airgun... (1 Reply)
Discussion started by: kristinu
1 Replies
dfshares_nfs(1M)					  System Administration Commands					  dfshares_nfs(1M)

NAME
dfshares_nfs - list available NFS resources from remote systems SYNOPSIS
dfshares [ -F nfs] [-h] [server...] DESCRIPTION
dfshares provides information about resources available to the host through NFS. The -F flag may be omitted if NFS is the first file sys- tem type listed in the file /etc/dfs/fstypes. The query may be restricted to the output of resources available from one or more servers. dfshares without arguments displays all resources shared on the local system, regardless of file system type. Specifying server displays information about the resources shared by each server. Server can be any system on the network. If no server is specified, then server is assumed to be the local system. The output of dfshares consists of an optional header line (suppressed with the -h flag) followed by a list of lines containing whitespace- separated fields. For each resource, the fields are: resource server access transport where resource Specifies the resource name that must be given to the mount(1M) command. server Specifies the system that is making the resource available. access Specifies the access permissions granted to the client systems; however, dfshares cannot determine this information for an NFS resource and populates the field with a hyphen (-). transport Specifies the transport provider over which the resource is shared; however, dfshares cannot determine this information for an NFS resource and populates the field with a hyphen (-). A field may be null. Each null field is indicated by a hyphen (-) unless the remainder of the fields on the line are also null; in which case, the hyphen may be omitted. OPTIONS
-F nfs Specify the NFS file system type -h Suppress header line in output. FILES
/etc/dfs/fstypes ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWnfscu | +-----------------------------+-----------------------------+ SEE ALSO
mount(1M), share(1M), unshare(1M), attributes(5) SunOS 5.10 6 Nov 2000 dfshares_nfs(1M)
All times are GMT -4. The time now is 04:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy