![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Conditionally joining lines in vi | ifermon | UNIX for Dummies Questions & Answers | 0 | 06-04-2008 10:43 AM |
| Joining 3 lines at a time | Sabari Nath S | Shell Programming and Scripting | 14 | 12-21-2005 01:29 AM |
| Joining 2 lines in a file together | m223464 | Shell Programming and Scripting | 3 | 05-12-2005 12:42 PM |
| Joining multiple lines | beilstwh | Shell Programming and Scripting | 4 | 03-02-2005 05:51 AM |
| Joining lines in log file | bubba112557 | Shell Programming and Scripting | 3 | 05-18-2004 08:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Joining lines from two files - please help
Hello,
I have 2 files say File 1 has ABC DEF GHI File 2 has 123 456 789 I need output as ABC 123 DEF 456 GHI 789 I tried awk and sed but not able to get it in the right way. Please help. Thanks |
|
||||
|
That helps, Thanks. I am looking for some thing like, even if 123 is in a different line on file2, it has to print next to ABC.
What I am trying to do is, I am doing ls -lrt on two directories which have same files ,and printing filename and the size to a file. Now I want those two files with filename and filesize to be in the output file so that I can compare the file sizes. When I say paste, it works when there are exactly same files in the directories, but if there is an extra file in any one dir, the pattern changes. Any ideas ??? |
|
||||
|
You could try something like this: Code:
printf "%-40s %-15s %-15s %-15s\n" "File" "Size Location 1" "Size Location 2" "Difference"
print "========================================" "===============" "===============" "==============="
for i in $(ls -1F /your/first/path)
do
[[ ${i} = */ ]] && continue
FILE_SIZE_1=$(ls -l /your/first/path/${i} | nawk '{print $5}')
FILE_SIZE_2=$(ls -l /your/second/path/${i} | nawk '{print $5}')
printf "%-40s %15d %15d %15d\n" "${i}" "$FILE_SIZE_1" "$FILE_SIZE_2" "$(( FILE_SIZE_1 - FILE_SIZE_2 ))"
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|