04-29-2008
Delete rest of the line
Hi, can anyone please answer my question in deleting the rest of the line. I have an example below of a file contaning:
Serial3/1.5 43.70.195.13 YES NVRAM down down
Serial3/3 225.94.155.69 YES NVRAM up down
Serial3/6 unassigned YES NVRAM administratively down down
Serial3/7 unassigned YES NVRAM up down
ATM2/0 unassigned YES NVRAM up down
My question is how do I delete the rest of the line except the first word from each line.
My result should be
Serial5/1.5
Serial3/3
Serial 3/6
.
.
.
Regards,
Aejaz
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Dear people, can you please enlighten:
I need to do a (most probably) very simple thing but couldn't figure how.
I have files with lots of lines starting with a fixed expression:
Query=. (the dot is a space)
followed by different combinations of characters including special ones such... (5 Replies)
Discussion started by: roussine
5 Replies
2. Shell Programming and Scripting
Hi Guys,
I need to search a string and print the rest of the lines...
input: 8 0 90 1 0 59 20 2488 96 30006dde372 S ? 0:00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n
output: 00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n
Actually i don even need the first "00".. any suggestions is appreciated..... (13 Replies)
Discussion started by: mac4rfree
13 Replies
3. Shell Programming and Scripting
Hi all,
Our application installation uses "sed" command to delete rest of line. It work perfect on Linux but fail on Solaris.
The OS versions are Solaris 9 and Linux Red Hat AS 3.
yourfile.txt
hello and world
cat and dog
hello world
in linux:
cat yourfile.txt | sed ‘s/\(\+\)... (3 Replies)
Discussion started by: javac2005
3 Replies
4. UNIX for Dummies Questions & Answers
Hiiii
I have a file which contains huge data as
a.dat:
PDE 1990 1 9 18 51 28.90 24.7500 95.2800 118.0 6.1 0.0 BURMA
event name: 010990D
time shift: 7.3000
half duration: 5.0000
latitude: 24.4200
longitude: 94.9500
depth: 129.6000
Mrr: ... (7 Replies)
Discussion started by: reva
7 Replies
5. Shell Programming and Scripting
i need to find ' - ' in a line , if i found i need to rest of the line including '-'
example
libmm-2.0
libytytsunos-5.6
output
libmm
libytytsunos (7 Replies)
Discussion started by: girija
7 Replies
6. Shell Programming and Scripting
Need to remove rest of line after the equals sign on search pattern from the searchfile. Can anybody help. Couldn't find any similar example in the forum:
infile:
64_1535: Delm. = 86 var, aaga
64_1535: Fran. = 57 ex. ccc
64_1639: Feb. = 26 (link). def
64_1817: mar. = 3/4. drz ... (7 Replies)
Discussion started by: sdf
7 Replies
7. UNIX for Dummies Questions & Answers
Hi friends,
I have a file where I should search for a string and get the rest of the line but without the delimiter using awk.
for example I have the series of string in a file:
input_string.txt
bbb
ccc
aaa
and the mapping file looks like this.
mapping.txt
aaa|12
bbb|23
ccc|43... (11 Replies)
Discussion started by: kokoro
11 Replies
8. Shell Programming and Scripting
Hi,
I have one requiremnet like this. I need to find some particular string (eg.IncludeDateTime = ) in a file. And wherever it finds the string the unix script has to delete the remaining text coming after the string (ie., 'IncludeDateTime = ' ) in the same line. I tried to write this script in... (5 Replies)
Discussion started by: jannusuresh
5 Replies
9. UNIX for Advanced & Expert Users
Hi ,
i have a file with data as below.This is same file. But actual file contains to many rows.
i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ?
Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies
10. Programming
Could you tell me the possibilities of the reason to get the Mismatched free() / delete / delete .
I unable to see the line no in the valgrind report. it displays the function name. with that function name, I am not able to find where exactly the issue is there.I am getting the Mismatched free()... (3 Replies)
Discussion started by: SA_Palani
3 Replies
LEARN ABOUT OPENDARWIN
nvram
nvram(8) System Manager's Manual nvram(8)
NAME
nvram - manipulate Open Firmware NVRAM variables
SYNOPSIS
nvram [ -p ] [ -f filename ] [ name ] [= value ] ...
DESCRIPTION
The nvram command allows manipulation of Open Firmware NVRAM variables. It can be used to get or set a variable. It can also be used to
print all of the variables or set a list of variables from a file. Changes to NVRAM variables are only saved by clean restart or shutdown.
In principle, name can be any string. In practice, not all strings will be accepted. New World machines can create new variables as
desired. Some variables require administrator privilege to get or set.
The given value must match the data type required for name. Binary data can be set using the %xx notation, where xx is the hex value of
the byte. The type for new variables is always binary data.
OPTIONS
-p Print all of the Open Firmware variables.
-f filename
Set Open Firmware variables from a text file. The file must be a list name=value statements. If the last character of a line is ,
the value will be continued to the next line.
EXAMPLES
example% nvram boot-args="-s rd=*hd:10"
Set the boot-args variable to "-s rd=*hd:10". This would specify single user mode with the root device in hard drive partition 10.
example% nvram my-variable="String One%00String Two%00%00"
Create a new variable, my-variable, containing a list of two C-strings that is terminated by a NUL.
December 12, 2000 nvram(8)