Search Results

Search: Posts Made By: Amrutha24
1,254
Posted By RudiC
sh two.sh "$param1" "$param2"
sh two.sh "$param1" "$param2"
1,254
Posted By PikK45
change one.sh echo "JOB STARTED" echo...
change one.sh


echo "JOB STARTED"
echo "JOB START TIME: `date +%D:%H:%M:%S`"
echo "give parameters:\n param1:"
read param1
echo "param2:"
read param2
sh two.sh $param1 $param2
echo "JOB...
13,760
Posted By Scrutinizer
Do you mean the last line has no trailing...
Do you mean the last line has no trailing newline? In that case you may or may not be able to use sed some can, but some cannot handle that. Try printf "\n" >> file

--
@hanson44: most seds cannot...
13,760
Posted By hanson44
I think this will add newline to end of last...
I think this will add newline to end of last line:
sed "$ s/$/\n/" infile > outfile
4,584
Posted By Scrutinizer
You need to use files that are in unix-format,...
You need to use files that are in unix-format, not DOS-format. To convert:
tr -d '\r' < infile > outfile
4,584
Posted By Subbeh
This is another way of doing it with awk which...
This is another way of doing it with awk which works for me:
awk 'BEGIN{while((getline f<FILENAME)>0){if(length(f)>l)l=length(f)}}{printf "%-"l"s\n",$0}' file
4,584
Posted By pravin27
awk 'NR==FNR{if(length($0) >...
awk 'NR==FNR{if(length($0) > maxlen){maxlen=length($0)}next}
{printf "|%-"maxlen"s|\n",$0}' file1.txt file1.txt Once you are confirm with o/p then remove "|" from the above code
7,609
Posted By RudiC
Rather try awk -v l="$LEN" ...
Rather try awk -v l="$LEN" '{s="%-"l"s\n";printf(s,$0);}' $FILE > temp1.txt;orawk -v l="$2" '{s="%-"l"s\n";printf(s,$0);}' $1 > temp1.txt;
7,609
Posted By Yoda
FILE="partial.txt" LEN=285 echo | awk -v...
FILE="partial.txt"
LEN=285

echo | awk -v l="$LEN" -v file="$FILE" '{s="%-"l"s\n"; while(( getline line < file ) > 0 ) { print s,line; } } '
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 04:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy