06-07-2005
zazzybob,
perl -pi -e '$_ = "" if ( $. == 1 );' large_file
I am trying to convert the above perl command line you reference to a script.
I am not sure what the -pi does for the command line. But what I have below works but I am wondering if it is efficent or should be done in another manner.
$ cat junk
#!/usr/bin/perl
open (infile, "+< /adsm/ACTIVITIES/CHANGES/TGA2_OBSOLETE_CLNUP/x ");
open (outfile,">/adsm/ACTIVITIES/CHANGES/TGA2_OBSOLETE_CLNUP/z");
while ( $line = <infile>) {
if ($. == 1) {
}
else {
print (outfile "$line");
}
} #end while
system ("cp /adsm/ACTIVITIES/CHANGES/TGA2_OBSOLETE_CLNUP/z /adsm/ACTIVITIES/CHANGES/TGA2_OBSOLETE_CLNUP/x");
close(infile);
close(outfile);
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
How can I removed the directory in the input file?
The script responsible for storing the report in an input file is this:
while }" ]
do
echo "penetration|${penfilename}|${penfilenamedaterange}" >> ${OUT_DIR}/penrpt_emailfile.txt
(( i=i+1 ))
done
For the penfilename:
... (2 Replies)
Discussion started by: chrysSty
2 Replies
2. Shell Programming and Scripting
Hello,
Im very new to PERL and as a project to work on developing my skills at PERL Im trying to parse poker hands.
Ive tried many methods however I cant get the last step.
$yourfile= 'FILENAME';#poker hands to parse
open (FILE, "$yourfile") or die $!;
@lines = <FILE>;
for (@lines) ... (1 Reply)
Discussion started by: Ek0
1 Replies
3. Shell Programming and Scripting
I am working with bash on HP-UX server at school.
As practice for scripting, I am trying to make a pretend server admin script that adds a user to the system, deletes a user from the system, and lists all users of the pretend system. I have accomplished this with a select loop. Adding users, and... (2 Replies)
Discussion started by: masterscout1977
2 Replies
4. Shell Programming and Scripting
I have two files.
Fileone contains
text string one
text string two
text string three
Filetwo contains
Name:
Address:
Summary:
Name:
Address:
Summary:
Name:
Address:
Summary:
I would like to use sed to read each line of file one and put it at the end of the summary line of file... (3 Replies)
Discussion started by: dolacap
3 Replies
5. Shell Programming and Scripting
I have file that looks like:
ATOM 2517 O VAL 160 8.337 12.679 -2.487
ATOM 2518 OXT VAL 160 7.646 12.461 -0.386
TER
ATOM 2519 N VAL 161 -14.431 5.789 -25.371
ATOM 2520 H1 VAL 161 -15.336 5.698 -25.811
ATOM 2521 H2 VAL 161 -13.416 10.529 17.708
ATOM 2522 H3 VAL 161 -14.363 ... (4 Replies)
Discussion started by: kanikasharma
4 Replies
6. Shell Programming and Scripting
Hi,
I've got a text file with hundreds of lines I need to upload to an API via curl, one by one.
The text file is like:
2012-08-01 10:45,124
2012-08-02 10:45,132
2012-08-03 10:45,114
I want to get curl to go through the text file sending a post for each line.
like:
curl --request... (0 Replies)
Discussion started by: emdeex
0 Replies
7. Shell Programming and Scripting
How to write in awk to remove lines starting with "#" and then process the file:
This is not working:
cat file|awk '{if ($0 ~ /^#/) $0="";print NF>0}'
When I just give cat file|awk '{if ($0 ~ /^#/) $0="";print }'
it prints the blank lines . I don't wnat the blank lines along with the... (15 Replies)
Discussion started by: rveri
15 Replies
8. Homework & Coursework Questions
Just started learning Unix and received my first assignment recently. We haven't learned many commands and honestly, I'm stumped. I'd like to receive assistance/guidance/hints.
1. The problem statement, all variables and given/known data:
How do I write a shell script that takes in a file or... (4 Replies)
Discussion started by: fozilla
4 Replies
9. Shell Programming and Scripting
Hi,
I have log like this:
... (1 Reply)
Discussion started by: justbow
1 Replies
10. Shell Programming and Scripting
Hi,
I have log like this:
... (1 Reply)
Discussion started by: justbow
1 Replies
LEARN ABOUT DEBIAN
dxf2vrml
DIME(1) General Commands Manual DIME(1)
NAME
dxf2vrml - program to convert .dxf formatted 3-D datasets to .VRML format.
SYNOPSIS
dxf2vrml [infile][-ooutfile][-emaxerr][-f][-l]
DESCRIPTION
This manual page documents briefly the dxf2vrml command. (default infile is stdin, default outfile is stdout) This manual page was written
for the Debian GNU/Linux distribution because the original program does not have a manual page. Instead, it has documentation in the GNU
Info format; see below.
dxf2vrml is a program that...
OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is
included below. For a complete description, see the Info files.
infile default infile is stdin
-o outfile,
default outfile is stdout
-e, Maximum error when tessellating curves
-f, Respect the $FILLMODE header variable
-vrml2,
Write as vrml2. Default is vrml1
-l, Use layer color, ignore the color index
-s, Set sub parameter
-h, Show useage.
SEE ALSO
files in: /usr/share/doc/libdime/, /usr/share/doc/libdime-dev/.
The programs are documented fully by http://www.coin3d.org/lib/dime/, available via the Internet.
AUTHOR
This manual page was written by A. Maitland Bottoms <bottoms@debian.org>, for the Debian GNU/Linux system (but may be used by others).
January 11, 2002 DIME(1)