I want to read a file line by line and exclude the lines that are beginning with special characters. The below code is working fine except when the line starts with hyphen (-) in the file.
Code:
for TEST in `cat $FILE | grep -E -v '#|/+' | awk '{FS=":"}NF > 0{print $1}'`
do
.
.
done
How should the grep statement be modified to ignore the line starting with hyphen?
Thanks
Srinraj
Last edited by Don Cragun; 06-19-2015 at 02:32 AM..
Reason: Add CODE tags.
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT OPENSOLARIS
dfshares
dfshares(1M) System Administration Commands dfshares(1M)NAME
dfshares - list available resources from remote or local systems
SYNOPSIS
dfshares [-F FSType] [-h] [-o specific_options] [server]...
DESCRIPTION
dfshares provides information about resources available to the host through a distributed file system of type FSType. specific_options as
well as the semantics of server are specific to particular distributed file systems.
If dfshares is entered without arguments, all resources currently shared on the local system are displayed, regardless of file system
type.
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 name of the system that is making the resource available.
access Specifies the access permissions granted to the client systems, either ro (for read-only) or rw (for read/write). If dfshares
cannot determine access permissions, a hyphen (-) is displayed.
transport Specifies the transport provider over which the resource is shared.
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 FSType Specify filesystem type. Defaults to the first entry in /etc/dfs/fstypes.
-h Suppress header line in output.
-o specific_options Specify options specific to the filesystem provided by the -F option.
FILES
/etc/dfs/fstypes
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO dfmounts(1M), mount(1M), share(1M), unshare(1M), attributes(5)SunOS 5.11 6 Nov 2000 dfshares(1M)