Edit a large text file
This should be easy and I dont know the best way to go about this. I have a large output of an ls command. The following is a part of the output.
Code:
/mnt/lfs/oldsrc: Code:
/mnt/lfs/oldsrc/ |
assuming you have the file names in a file called /mnt/lfs/oldsrc, you could do something like:
#!/bin/bash rm -rf /tmp/output for LINE in `cat /mnt/lfs/oldsrc`; do echo "/mnt/lfs/oldsrc/$LINE" >>/tmp/output done |
I think what you are looking for is actually some variation of the find or locate commands
try this: Code:
locate auto* | grep /mnt/lfs/oldsrc If locate gives an error, you may not have an index database setup, in which case you need to run as root: Code:
updatedb Let us know how you get on. The post from zQUEz looks good too! |
I got the file by running
Code:
ls -AR /mnt/lfs/ > testing.out |
Hi,
Wouldn't this be a better(?) solution: find /mnt/lfs/ The 'only' difference between your desired output and that of the find command: You show a / after each dir (/mnt/lfs/oldsrc/ vs /mnt/lfs/oldsrc). |
Quote:
Code:
find /mnt/lfs -type d -printf '%p/\n' -o -print |
Quote:
Code:
find /mnt/lfs I tried running this command, on my server. Code:
[root@vikas ~]# find /tmp/ |wc -l |
Hi,
The difference can be found in the way directories are displayed, not the amount of files found. find /mnt/lfs will show a directory as: /mnt/lfs/usr/bin ntubski solution will show: /mnt/lfs/usr/bin/ (mind the extra slash on the end!) Hope this clears things up. |
Quote:
Thanks |
All times are GMT -5. The time now is 12:05 PM. |