Files manipulation in Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Files manipulation in Linux
# 1  
Old 10-13-2011
Question Files manipulation in Linux

Hello ,

I started learning shell scripting recently and I was able to use grep and awk command to get a columns or rows with a certain format out of one file and put them in a new one using :
Code:
grep -e "N -t 99.998" xxx.txt > temp1.txt

and
Code:
awk < temp1.txt '{print $5," ",$ 7} '> temp32.txt

and I'm currently looking for a way to delete all generated

raws -except the last one-in two files and put the last line of
each file in a single new file .

is there a command that can do that ??!!!!

If there's can you guide on how to use it if possible or even just tell me what it is ??!!

Thank you

Lina

Last edited by Franklin52; 10-14-2011 at 03:33 AM.. Reason: Please use code tags, thank you
# 2  
Old 10-13-2011
Code:
tail -1

# 3  
Old 10-14-2011
Than you for answering my question . I use tail to get the last

line of a single file and log it in a new one but can I use the tail

command to log the last line of a multiple files in a single file

??!!! or I should use another method ??!

Thanks again
# 4  
Old 10-14-2011
one method ..
Code:
$ find /your/files/path -type f -exec tail -1 {} \;

This User Gave Thanks to jayan_jay For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

2. Shell Programming and Scripting

[Solved] awk manipulation of sequentially named files

Hello, I am a very novice user of awk, I have a set of files named file001, file002, file003, file004, etc., each contains four fields (columns of data) separated each by a uneven number of spaces. I want to substitute those spaces by a TAB, so I am using this line of awk script: awk -v OFS="\t"... (4 Replies)
Discussion started by: jaldo0805
4 Replies

3. Shell Programming and Scripting

columns manipulation in different files

Hi all, I have 3 files with data as : 1.txt 1 1 1 5 2.txt -5 1 0 3 3.txt 0 1 0 (1 Reply)
Discussion started by: AKD
1 Replies

4. Shell Programming and Scripting

Bash folder manipulation - selecting/copying specified files

Bash/scripting newbie here - I feel this might be a trivial problem, but I'm not sure how to tackle it. I've got a folder of a year's worth of files, with some random number of files generated every day of the year (but at least one per day). I'm writing a script to automatically grab the file with... (6 Replies)
Discussion started by: WildGooseChased
6 Replies

5. UNIX for Dummies Questions & Answers

String manipulation in Linux & Unix (Solaris)

Guy I have this below report and I need someone help me formatting it SID File Name Started Finished Backup ABC XYZ.log 10Sep09-012857\n 10Sep09-020748 Successful I need Started & Finished columns to be formatted as ... (1 Reply)
Discussion started by: anjum.suri
1 Replies

6. UNIX for Dummies Questions & Answers

Date Manipulation with files

Hi, I have a timestamp stored in a variable start_time=17-JUL-2009 03:45, I need to search a file for this time stamp line by line (where each line has a time stamp in the file) if the time stamp is greater than the start_time variable value need to grep that line for a string and if the string... (2 Replies)
Discussion started by: happyrain
2 Replies

7. UNIX for Advanced & Expert Users

Huge files manipulation

Hi , i need a fast way to delete duplicates entrys from very huge files ( >2 Gbs ) , these files are in plain text. I tried all the usual methods ( awk / sort /uniq / sed /grep .. ) but it always ended with the same result (memory core dump) In using HP-UX large servers. Any advice will... (8 Replies)
Discussion started by: Klashxx
8 Replies

8. Shell Programming and Scripting

Files manipulation with time comparison

Hi guys - I am new to Unix and learning some basics. I have to create a report of files that are in a specific directory and I have to list filenames with specific titles. This report will be created everyday early in the morning, say at 05:00 AM. (see output file format below) The 2 categories... (2 Replies)
Discussion started by: sksahu
2 Replies
Login or Register to Ask a Question