Simple perl question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Simple perl question
# 1  
Old 12-22-2009
Simple perl question

I am totally new to perl. I am modifying someone else's script. I have the following output:

# ./some-perlscript
A
B
C
D
E

B - E, is generated through the print command that I put in the script. I want to remove A, it seems it is generated automatically by a custom OS it is querying when I run a specific command in the script, so I want the output to be

# ./some-perlscript
B
C
D
E
# 2  
Old 12-22-2009
Quote:
Originally Posted by streetfighter2
I am totally new to perl. I am modifying someone else's script. I have the following output:

# ./some-perlscript
A
B
C
D
E

B - E, is generated through the print command that I put in the script. I want to remove A, it seems it is generated automatically by a custom OS it is querying when I run a specific command in the script, so I want the output to be

# ./some-perlscript
B
C
D
E
Hello is it closed source? that you are abstaining from showing us the perl code?
what do you mean by custom OS? is it a syscall that you mean?
##This is none of your street fights##
Do reply,
Regards
# 3  
Old 12-22-2009
Quote:
Originally Posted by gaurav1086
Hello is it closed source? that you are abstaining from showing us the perl code?
what do you mean by custom OS? is it a syscall that you mean?
##This is none of your street fights##
Do reply,
Regards
Yes the code is closed source as it is not mine to post. Also I was wondering if a simple pipe to awk would satisfy this?

I have the following command:

Code:
#./some-perlscrip | awk 'BEGIN {FS="\n"} {print $2, $3, $4, $5}

But its not working it is only printing

Code:
A

instead of

Code:
B
C
D
E



---------- Post updated at 05:48 PM ---------- Previous update was at 05:40 PM ----------

Actually nevermind guys, I just redirected the output to a file and got the expected results.

Thanks!
# 4  
Old 12-22-2009
Code:
$
$ ./some-perlscript
A
B
C
D
E
$
$ ./some-perlscript | awk 'NR>1'
B
C
D
E
$
$ # or maybe this
$ ./some-perlscript | perl -lne 'print if $.>1'
B
C
D
E
$
$

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simple Perl question

Hello, I'm completely new to Perl and I'm just looking for a quick answer to some code I'm trying to come up with. I'm trying to access a website, part of the URL I want the user to be able to define via standard input. As you can see below I'm still trying to get the syntax. ... (2 Replies)
Discussion started by: wxornot
2 Replies

2. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

3. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

4. Shell Programming and Scripting

Simple Question about Reading file by Perl

Hi , I just write a simple function to read the file line by line. But when I run it it says out of memory. I am not sure about the root cause, Can someone help me out of this? :D #! /usr/bin/perl use strict; sub checkAPs{ my $NDPDir = "/home/eweiqqu/NCB/NDP_files/"; ... (1 Reply)
Discussion started by: Damon_Qu
1 Replies

5. Shell Programming and Scripting

PERL: simple comparing arrays question

Hi there, i have been trying different methods and i wonder if somebody could explain to me how i would perform a comparison on two arrays for example my @array1 = ("gary" ,"peter", "paul"); my @array2 = ("gary" ,"peter", "joe"); I have two arrays above, and i want to something like this... (5 Replies)
Discussion started by: hcclnoodles
5 Replies

6. Shell Programming and Scripting

perl: simple question on string append

I want to append a decimal number to a string. But I want to restrict the number to only 2 decimal points for e.g: my $output = "\n The number is = "; my $number = 2.3333333; $output = $output . $number; But I want the $output as: "The number is = 2.33"; and not 2.3333333 (I do not... (1 Reply)
Discussion started by: the_learner
1 Replies

7. Programming

Simple C question... Hopefully it's simple

Hello. I'm a complete newbie to C programming. I have a C program that wasn't written by me where I need to write some wrappers around it to automate and make it easier for a client to use. The problem is that the program accepts standard input to control the program... I'm hoping to find a simple... (6 Replies)
Discussion started by: Xeed
6 Replies

8. UNIX for Dummies Questions & Answers

Ok simple question for simple knowledge...

Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies

9. UNIX for Dummies Questions & Answers

Simple question

I am taking an intro to unix class and I can not figure out how to do part of the question. I am writing script to be exictued by a program in the tutoral. Question: Write every line containing the word ``delete'' produced by ``man mail'' into a file called ``delete''. Hint: What does using... (1 Reply)
Discussion started by: weathergirl
1 Replies

10. UNIX for Dummies Questions & Answers

Simple Question

Hi All, I am new to UNIX Shell Scripting. I want to know what is the difference between the following two statements. if and if Thanks & Regards (3 Replies)
Discussion started by: tvkamesh
3 Replies
Login or Register to Ask a Question