Sponsored Content
Top Forums UNIX for Dummies Questions & Answers cat a file from end to beginning Post 1810 by PxT on Friday 30th of March 2001 07:10:19 PM
Old 03-30-2001
Quote:
cat file | perl -e 'print reverse <>'
Just do perl -e 'print reverse <>' file

However, the down side to the perl method is that the whole file must be read into memory. Could be a memory-hog for extremely large files. I believe 'tac' uses seek to read through the file, so that you can view files of arbitrary size. Usually not a problem though. The perl method is good if you dont have 'tac' installed.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Append (cat) to beginning of file ?

Hi, Fairly new to unix scripting, hoping to get some help. using AIX v5 Basically I have 3 files 1). Header record 2). many detail record 3). Trailer record My desired result is 1 file which contains Heaeder, Detail, Trailer Currenty I am using a series of: ... (8 Replies)
Discussion started by: CBZ
8 Replies

2. Shell Programming and Scripting

Insert two strings at the beginning and at the end of each line of a file

Hi, excuse me for my poor english. My problem is that: I have a File i want to add to each line of that file two strings: one at the beginning of the line, one at the ending. string1="abcd" string2="efgh" i want $string1 content $string2 for each line. Is that possible? (3 Replies)
Discussion started by: Linux-fueled
3 Replies

3. Shell Programming and Scripting

How to write a new entry at the beginning of a log file instead of at the end?

Hi Ladies and Gents, Explanation of my question with an example: Let's consider the script: backup_every_hour.sh #!/bin/bash rsync -auv $dir $backup_dir >> backup_every_hour_script.log Each time this script is called there will be a new entry at the end of the file... (1 Reply)
Discussion started by: freddie50
1 Replies

4. Shell Programming and Scripting

trying to add text to beginning and end of each line

Well here goes: I tried to write a batch file that adds a specific fixed text to each line of an already existing text file. for the adding text infront of each line I tried this: for /F "delims=" %%j in (list.txt) do echo.STARTTEXT\%%j >> list.txt for adding text after each line I... (0 Replies)
Discussion started by: pasc
0 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Appending beginning of filename to end

Hi Guys, I have serveral directories like this: (2013) blablabla(blabla) - blabla (blabla) or (1997) blablabla(blabla) - blabla (blabla) and have to rename them to something like that: blablabla(blabla) - blabla (blabla) (2013) and blablabla(blabla) - blabla (blabla) (1997) Easy... (2 Replies)
Discussion started by: Nateshift
2 Replies

6. Shell Programming and Scripting

Add new line at beginning and end of a file

Hi, I have a specific requirement to add text at the beginning and end of a plain text file. I tried to use "sed" with '1i' and '$a' flags but these required two separate "sed" commands separated with "|". I am looking for some command/option to join these two in single command parameter. ... (6 Replies)
Discussion started by: bhupinder08
6 Replies

7. Shell Programming and Scripting

Add words in beginning , end after removing a word in a file

My file has the entries like below... /dev/sds /dev/sdak /dev/sdbc /dev/sdbu I want to make the file like below echo 1 > /sys/block/sds/device/rescan echo 1 > /sys/block/sdak/device/rescan echo 1 > /sys/block/sdbc/device/rescan echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Discussion started by: saravanapandi
2 Replies

8. Shell Programming and Scripting

How to append in the beginning not at the end?

Hi, I now that >> will append text to the end of the text that is already inside the file. How to append the new text infront of the text that is already in the file. Thanks for any input. Regards, Chandu (3 Replies)
Discussion started by: chandrakanth
3 Replies

9. Shell Programming and Scripting

Adding test to beginning and end of list in a file

Hi all and apologies for the silly question, but I've searched and I can't get this right. I have a list of email addresses in a file that I need to blacklist (spam). the list is quite long and I would need to script a small routine so that I can get the following for each line in the file: db... (4 Replies)
Discussion started by: bm555
4 Replies
PERLIVP(1)						 Perl Programmers Reference Guide						PERLIVP(1)

NAME
perlivp - Perl Installation Verification Procedure SYNOPSIS
perlivp [-p] [-v] [-h] DESCRIPTION
The perlivp program is set up at Perl source code build time to test the Perl version it was built under. It can be used after running: make install (or your platform's equivalent procedure) to verify that perl and its libraries have been installed correctly. A correct installation is verified by output that looks like: ok 1 ok 2 etc. OPTIONS
-h help Prints out a brief help message. -p print preface Gives a description of each test prior to performing it. -v verbose Gives more detailed information about each test, after it has been performed. Note that any failed tests ought to print out some extra information whether or not -v is thrown. DIAGNOSTICS
o print "# Perl binary `$perlpath' does not appear executable. "; Likely to occur for a perl binary that was not properly installed. Correct by conducting a proper installation. o print "# Perl version `$]' installed, expected $ivp_VERSION. "; Likely to occur for a perl that was not properly installed. Correct by conducting a proper installation. o print "# Perl @INC directory `$_' does not appear to exist. "; Likely to occur for a perl library tree that was not properly installed. Correct by conducting a proper installation. o print "# Needed module `$_' does not appear to be properly installed. "; One of the two modules that is used by perlivp was not present in the installation. This is a serious error since it adversely affects perlivp's ability to function. You may be able to correct this by performing a proper perl installation. o print "# Required module `$_' does not appear to be properly installed. "; An attempt to "eval "require $module"" failed, even though the list of extensions indicated that it should succeed. Correct by con- ducting a proper installation. o print "# Unnecessary module `bLuRfle' appears to be installed. "; This test not coming out ok could indicate that you have in fact installed a bLuRfle.pm module or that the "eval " require "$mod- ule_name.pm"; "" test may give misleading results with your installation of perl. If yours is the latter case then please let the author know. o print "# file",+($#missing == 0) ? '' : 's'," missing from installation: "; One or more files turned up missing according to a run of "ExtUtils::Installed -> validate()" over your installation. Correct by con- ducting a proper installation. o print "# Perl header `$_' does not appear to be properly installed. "; Correct by running h2ph over your system's C header files. If necessary, edit the resulting *.ph files to eliminate perl syntax errors. For further information on how to conduct a proper installation consult the INSTALL file that comes with the perl source and the README file for your platform. AUTHOR
Peter Prymmer perl v5.8.0 2003-02-18 PERLIVP(1)
All times are GMT -4. The time now is 07:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy