Sponsored Content
Top Forums Shell Programming and Scripting Can someone please help me? (Another example of how not to post homework.) Post 302390774 by andrew1400 on Friday 29th of January 2010 02:08:53 AM
Old 01-29-2010
Can someone please help me? (Another example of how not to post homework.)

Hi,
when I run ls -l I get the following command (I already know ls) :
Code:
rwxrwxrwx 2 andrew andrew 4096 2010-01-25 22:00 test.txt
rwxrwxrwx 2 andrew andrew 4096 2010-01-25 21:01 test1.txt
rwxrwxrwx 3 andrew andrew 4096 2010-01-25 20:45 test2.txt
rwxrwxrwx 1 andrew andrew 4096 2010-01-25 01:12 test3.txt

I want to write a bash program that uses : cut, grep, sed and pipes
and makes the output asfollow (I know ls give me the name only,but i have to use ls -l):
Code:
-test.txt
-test1.txt
-test2.txt
-test3.txt

(there has to be a dash)


what should I use(I just know I should use the pipe):
ls -l |

Last edited by Yogesh Sawant; 01-29-2010 at 03:45 AM.. Reason: added code tags
 

4 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Can someone please help me? (An example of how not to post homework.)

Hi, when I run ls -l I get the following command (I already know ls) : Code: rwxrwxrwx 2 andrew andrew 4096 2010-01-25 22:00 test.txt rwxrwxrwx 2 andrew andrew 4096 2010-01-25 21:01 test1.txt rwxrwxrwx 3 andrew andrew 4096 2010-01-25 20:45 test2.txt rwxrwxrwx 1 andrew andrew 4096... (1 Reply)
Discussion started by: andrew1400
1 Replies

2. Post Here to Contact Site Administrators and Moderators

Help with deleting post, apologies about the earlier post.

Apologies about the earlier post, i didnt realise, could i delete that post? I apologise again, SynGc (1 Reply)
Discussion started by: SynGc
1 Replies

3. Post Here to Contact Site Administrators and Moderators

Do I post to Homework forum if learning on own

Quick question, I'm learning shell scripting on my own from resources like the 'Teach Yourself' books, web sites, etc. If I have any questions about these materials, do I still need to post them to the homework section? The template asks specific things like school associated with or... (7 Replies)
Discussion started by: Chasman78
7 Replies

4. Post Here to Contact Site Administrators and Moderators

Apparently my post is Homework/Classwork?

I previously posted a question in the Shell Scripting forum a few minutes ago. I recieved a message telling me I had breached a rule, apparently because my post was a homework infraction. Well, im currently trying to figure out how to use Raspberry Pi's (as im a starter) I asked one of my... (1 Reply)
Discussion started by: Waggie14
1 Replies
NETSED(1)							      NetSED								 NETSED(1)

NAME
netsed - a network stream editor. SYNOPSIS
netsed {proto} {lport} {rhost} {rport} {rule} [rule ...] DESCRIPTION
netsed is a small and handy utility to alter, in real time, the contents of packets forwarded in a network stream, or in a datagram connection. When called with a set of replacement rules, these rules are tested for applicability to each packet entering in either direction. ARGUMENTS
proto Determines the protocol for the desired connection: "tcp", "TCP", "udp", or "UDP". lport The local listening port for the connection. A service name, or a numerical port value, is acceptable. rhost The remote host with whom the connection is desired. Resolvable host names and IPv4/IPv6 addresses are equally usable. As a special case, assigning "0" to rhost will insert the kernel's knowledge of the targeted host address, in a situation where a netfilter rule is redirecting traffic. This happens when running a transparent proxy service. rport The remote port to connect to. A service name, or a numerical port value, is acceptable. Also here a value "0" will be acceptable to arrange a transparent proxy service, as the kernel's tracking will provide the intended remote port number. rule At least one replacement rule is mandatory. The general syntax for this is: s/pat1/pat2[/num] The effect is to replace the text that matches pat1 with the expansion of pat2. The optional parameter num is a numerical value limiting the maximal number of times the rule can be applied. One could say that the rule expires after num occurrences. The rules are applied in succession to all passing packets, flowing in either direction. As soon as a rule has been expired, it is removed from the collection of active rules for the current connection. Observe that any counter is started as the connection is initiated, running as long as the connection is alive. This holds directly for TCP connections, whereas for UDP a connection is considered to consist of incoming data on fixed address and fixed port together with any response from a remote server. When no datagrams have been transmitted for a period of 30 seconds, the UPD connection is seen as closed. A single rule is limited to act on individual packets; a pattern can not match across packet boundaries. Using HTTP-like escape sequences for hexadecimal values, all eight-bit characters are viable in the patterns. Thus the standard character pair CRNL would code as "%0a%0d". In a pattern, the percentage sign itself must be escaped by duplication. Thus a string "%%" is interpreted in a pattern as a literal percentage sign. EXAMPLES
A handful replacement rules are handy as examples. s/andrew/mike Replace every occurrence of the string "andrew" with "mike", in every passing packet. s/andrew/mike/1 Replace only the first occurrence of the string "andrew" for "mike" in each packet. Any repetition is unaltered, unless a further rule specifies some replacement. s/andrew/mike%00%00 Replace in each packet every occurrence of the string "andrew" with "mikex00x00" . The padding with two null bytes ensures an unaltered packet length, which might be essential at times. s/%%/%2f/20 Replace the first twenty occurrences of the percentage character '%' with slashes '/'. AUTHOR
This text was initially compiled by Mats Erik Andersson as a Docbook source from the usage printout. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Public License, version 2, or of a later version. COPYRIGHT
Copyright (C) 2010 Mats Erik Andersson NetSED 1.00b June 19th, 2011 NETSED(1)
All times are GMT -4. The time now is 03:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy