grep & cut the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep & cut the file
# 1  
Old 06-25-2008
grep & cut the file

I need to grep and cut the some file in the folder and output to some file.
the sample file looks like below

-rw-r--r-- 1 gui gui 28050789 Jun 25 18:38 mymkzpiii.txt
-rw-r--r-- 1 gui gui 127983856 Jun 25 18:39 phmnlpiii.txt

i need the output like below


28050789 , mymkzpiii.txt
127983856 , phmnlpiii.txt

I managed to get like this using the following command but the delimiter is not coming

28050789 mymkzpiii.txt
127983856 phmnlpiii.txt

The comman i use is
pct=`ls -ltr /uu0/gui/dss/ixossdata/*.* | grep -v Filesystem|cut -c 30-43,82-100`

rds
# 2  
Old 06-25-2008
Your Mileage may vary
Code:
ls -ltr /uu0/gui/dss/ixossdata/*.* | nawk '!/Filesystem/ { print $5 "," $NF}'

# 3  
Old 06-25-2008
Hammer & Screwdriver Perhaps this might also work?

Code:
>ls -l | tr -s " " | tr " " "," | cut -d"," -f5,9

I think this is the output you are looking for?

663,conv_form
719,file1
717,file
# 4  
Old 06-25-2008
yes , it works this is what i want
thanks for your effort and help
rds
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cut line from searched file if grep find neighbor columns

Hello All, While searching for the question, I found some answers but my implementation is not giving expected output. I have two files; one is sourcefile, other is named template. What I want to do is to search each line in template, when found all columns, cut the matching line from source... (4 Replies)
Discussion started by: baris35
4 Replies

2. UNIX for Dummies Questions & Answers

Cut & awk

I am using the following code to modify all odd lines in a file: awk 'NR % 2 { print } !(NR % 2)' FWD-1.fas | cut -c5-600 I however, do not want cut to affect the odd lines Any help? (3 Replies)
Discussion started by: Xterra
3 Replies

3. Shell Programming and Scripting

Using Grep & find & while read line in a script

Hello people! I would like to create one script following this stage I have one directory with 100 files File001 File002 ... File100 (This is the format of content of the 100 files) 2012/03/10 12:56:50:221875936 1292800448912 12345 0x00 0x04 0 then I have one... (0 Replies)
Discussion started by: Abv_mx81
0 Replies

4. Shell Programming and Scripting

copying file information using awk & grep

Hi, TASK 1: I have been using this code to print the information of files kept at "/castor/cern.ch/user/s/sudha/forPooja" in some text file name FILE.txt. rfdir /castor/cern.ch/user/s/sudha/forPooja | grep data | awk '{print "rfio:///castor/cern.ch/user/s/sudha/forPooja/"$9}' > FILE.txt ... (6 Replies)
Discussion started by: nrjrasaxena
6 Replies

5. Shell Programming and Scripting

cut & AWK

HI all, i have the source file like below, 05 BL-FEE-CYC-CDE PIC S9(03) COMP-3. 05 BL-FEE-ERR-MSG PIC X(00030). 05 BL-FEE-TYPE PIC X(00001). 418181*# 05 ... (7 Replies)
Discussion started by: baskivs
7 Replies

6. Slackware

How should I cut this line using cut and grep?

not sure how to do it. wan't to delete it using cut and grep ince i would use it in the shell. but how must the command be? grep "64.233.181.103 wwwGoogle.com" /etc/hosts | cut -d the delimeter is just a space. can you help meplease. :D (1 Reply)
Discussion started by: garfish
1 Replies

7. Shell Programming and Scripting

Log file is not getting created & unable to grep error from it

Hi All, Below is my code,what I am trying to do is redirecting output of ftp to a log file & then greping the errors but here I am unable to grep "Permission denied" error only & also the corresponding log file is also not getting created. #!/bin/sh . cfg USER='abc' PASSWD='abc123' ... (4 Replies)
Discussion started by: ss_ss
4 Replies

8. Shell Programming and Scripting

how to grep a file and cut a corresponding value from the line

i have to grep a file which has contents like /Source/value/valuefile/readme.txt DefaultVersion:=1.7 I have to grep this file with "/Source/value/valuefile/readme.txt" and cut the corresponding value "1.7" from the same line i tried grep and cut but not working. (1 Reply)
Discussion started by: codeman007
1 Replies
Login or Register to Ask a Question