09-21-2010
How to redirect output of ls to a file?
Hi All,
I want to redirect only the file names to a new file from the ls -ltr directroy. how Can i do it.
my ls -ltr output will be as below.
-rwxr-xr-x 1 118 103 28295 Jul 26 2006 event.podl
-rwxr-xr-x 1 118 103 28295 Jul 26 2006 xyz.podl
I want my new file to have only event.podl . and xyz.podl
Pls Suggest.
Thanks in advance,
Giri.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi:
I am currently working on a program which requires direct its ouput to a file here is an example
./proram arg_1 arg_2
when program ends all output will be arg_2 file
Is that possible I am not a bad programmer, However I am stuck there.
Can anyone give a hint?
Thanks
SW (1 Reply)
Discussion started by: slackware
1 Replies
2. UNIX for Dummies Questions & Answers
Ahhhrrrggg I'm having a brain fart...
I want to take the output of a command and redirect it to a file...
This works....
$ man cp | cat >> copy_help
but this doesn't
keytool -help |cat >> keytool_help
It just produces... these lines...
more keytool_help
] ...
... (11 Replies)
Discussion started by: jimmyc
11 Replies
3. UNIX for Dummies Questions & Answers
Hi all!!
is possible to assign the output of some command to filename, i.e.
grep_output.txt
Otherwise, I want to open a new file which name is inside another, how can I do it?
Thanks a lot! (7 Replies)
Discussion started by: csecnarf
7 Replies
4. Shell Programming and Scripting
Hi guys,
i have a script named purgeErrors.ksh, when i execute this script i need to redirect the output to a log file in the same directory, how can i do that ??
-- Aditya (5 Replies)
Discussion started by: chaditya
5 Replies
5. Shell Programming and Scripting
I am trying to get following result from the scipt I have. First time it generates the o/p in correct format. However if I run it again it appends to the existing file. I would like to see o/p on screen as well as save it in file. Everytime it should create new file.
## I/P file
0174
0175... (3 Replies)
Discussion started by: dynamax
3 Replies
6. UNIX for Advanced & Expert Users
Hi,
I want to know how to redirect the output of topas -P to a file in a readable format. I tried doing it by using
topas -P > topas.txt but the output is not properly aligned and when I opened it using vi it ahd some characters.
Please help me out in this.
Thanks (1 Reply)
Discussion started by: Preetha
1 Replies
7. Shell Programming and Scripting
Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions.
... (4 Replies)
Discussion started by: aix_admin_007
4 Replies
8. UNIX for Dummies Questions & Answers
Hi ,
I am trying to redirect output of echo to a file.So i wrote a function named printline.Here is my sample script
myscript.sh
function printline()
{
echo "$1" >> myfile.log
}
usage()
{
printLine "********************USAGE*************************"
printLine "Script takes... (12 Replies)
Discussion started by: ASC
12 Replies
9. Shell Programming and Scripting
Hi Guys,
I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts.
I used below but it is not working:
OFILE=/home/home1/report1
echo "report1 details" > $OFILE
=/home/home1/1.sh > $OFILE
echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies
10. Shell Programming and Scripting
I m not able to redirect the java version to a file however, it shows as output when I run my script.
bash-3.2$ more 1test.tmp
java_version=`which java`
echo "MY JAVA:"$java_version
version=`"$java_version" -version`
echo $version >>/tmp/moht/java_version.log
$java_version -version 2... (4 Replies)
Discussion started by: mohtashims
4 Replies
LEARN ABOUT DEBIAN
cisco_ios2dlf
CISCO_IOS2DLF.IN(1) LogReport's Lire Documentation CISCO_IOS2DLF.IN(1)
NAME
cisco_ios2dlf - convert cisco logs to dlf format
SYNOPSIS
cisco_ios2dlf
DESCRIPTION
This script expects syslog-type logs from a CISCO IOS router on stdin. These look like e.g.
Jul 3 00:00:39 router 40108: 4d09h: %SEC-6-IPACCESSLOGP:
list FR_VA_in permitted udp 192.168.19.1(137) (Serial0/0.2 DLCI 120)
-> 192.168.19.255(137), 2 packets
Jul 3 00:02:39 router 40109: 4d09h: %SEC-6-IPACCESSLOGP: list FR_VA_in
permitted udp 192.168.80.42(138) (Serial0/0.2 DLCI 120) ->
192.60.60.148(138), 1 packet
Jul 3 00:02:39 router 40110: 4d09h: %SEC-6-IPACCESSLOGDP: list FR_VA_in
permitted icmp 192.168.80.82 (Serial0/0.2 DLCI 120) -> 149.1.1.1 (8/0),
1 packet
or
Aug 19 04:02:34 gateway.foo.bar 218963: Aug 19 04:02:32.977:
%LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0:1, changed state
to down
Aug 19 04:02:34 gateway.foo.bar 218964: Aug 19 04:02:33.262:
%ISDN-6-DISCONNECT: Interface BRI0:1 disconnected from 172605440 acme,
call lasted 42 seconds
Aug 19 04:02:35 gateway.foo.bar 218965: Aug 19 04:02:33.266:
%LINK-3-UPDOWN: Interface BRI0:1, changed state to down
Aug 19 04:02:38 gateway.foo.bar 218966: Aug 19 04:02:36.103:
%SEC-6-IPACCESSLOGP: list 102 denied tcp 100.198.139.148(4652) ->
100.193.176.49(80), 1 packet
Aug 19 04:02:45 gateway.foo.bar 218967: Aug 19 04:02:43.543:
%ISDN-6-LAYER2DOWN: Layer 2 for Interface BR0, TEI 86 changed to down
Aug 19 04:02:53 gateway.foo.bar 218968: Aug 19 04:02:51.471:
%SEC-6-IPACCESSLOGP: list 102 denied tcp 100.74.103.1(2162) ->
100.193.176.98(80), 1 packet
The outputted dlf files look like:
994118619 permitted icmp 192.168.80.9 - Serial0/0.2 DLCI_120
192.168.19.1 - 1
994118619 permitted udp 192.168.19.1 138 Serial0/0.2 DLCI_120
192.168.19.255 138 1
EXAMPLES
To process a log as produced by Cisco IOS:
$ cisco_ios2dlf < cisco.log
cisco_ios2dlf will be rarely used on its own, but is more likely called by lr_log2report:
$ lr_log2report cisco_ios < /var/log/cisco.log
AUTHORS
Francis J. Lacoste based on initial code by Joost Bekkers <joost@jodocus.org>
VERSION
$Id: cisco_ios2dlf.in,v 1.8 2006/07/23 13:16:35 vanbaal Exp $
COPYRIGHT
Copyright (C) 2001 Joost Bekkers <joost@jodocus.org> Copyright (C) 2002 Stichting LogReport Foundation <logreport@logreport.org>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html.
Lire 2.1.1 2006-07-23 CISCO_IOS2DLF.IN(1)