Search Results

Search: Posts Made By: thailand
884
Posted By Don Cragun
You could also try something like: awk -F ', *'...
You could also try something like:
awk -F ', *' '{printf("%-4s%-25s%-40s%s\n", $1 ",", $2 ",", $3 ",", $4)}' file
If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk,...
884
Posted By RavinderSingh13
Hello thiland, Could you please try...
Hello thiland,

Could you please try following for same, let me know if this helps.

awk -F, '{printf"%s,%s,%30s,%70s\n", $1, $2, $3, $4}' OFS=, Input_file


Output will be as follows.

1, ...
884
Posted By senhia83
may not be exactly what you want, but worth a try...
may not be exactly what you want, but worth a try

cat yourfile | column -s "," -t
946
Posted By SriniShoo
awk '/^timer/{$(NF+1)=++n}1' file.txt >...
awk '/^timer/{$(NF+1)=++n}1' file.txt > file1.txt
946
Posted By Scrutinizer
Try replacing $2+=1 with $2=++i
Try replacing $2+=1 with $2=++i
1,007
Posted By Peasant
If i understand the requirement correctly,...
If i understand the requirement correctly, perhaps this awk ?


awk '$1 <= 12 { $1=$1-2 }1' inputfile > outputfile
1,393
Posted By CarloM
It doesn't work because you missed out part of...
It doesn't work because you missed out part of the command:
awk '{ if ($0 ~ /[a-z]$/) {print $0"..."} else {print $0} }' RS="" ORS="\n\n" file

Also, please use [code] tags - it makes your code...
1,393
Posted By Chubler_XL
Nice solution CarloM, it can be simplified...
Nice solution CarloM, it can be simplified slightly:

awk '/[[:alpha:]]$/ {$0=$0 "..."}1' RS="" ORS="\n\n" infile2
1,393
Posted By shamrock
How about doing it for each keyword... sed -e...
How about doing it for each keyword...
sed -e 's/Alcuin$/&.../' -e 's/shield$/&.../' -e 's/death$/&.../' file
1,393
Posted By CarloM
An awk solution: awk '{ if ($0 ~...
An awk solution:
awk '{ if ($0 ~ /[[:alpha:]]$/) {print $0 "..."} else {print} }' RS="" ORS="\n\n" file
Forum: Ubuntu 06-20-2013
2,278
Posted By DGPickett
Man Page for apt-cdrom (all Section 8) - The UNIX...
Man Page for apt-cdrom (all Section 8) - The UNIX and Linux Forums (https://www.unix.com/man-page/all/8/apt-cdrom/) looks promising.
1,491
Posted By Chubler_XL
How about using awk: awk...
How about using awk:

awk 'length($3$4)<50{$3=$3" "$4;NF=3}1' RS= OFS='\n' ORS='\n\n' FS='\n' infile
2,257
Posted By Scrutinizer
awk '1;length<=m && /[[:alpha:][:space:],]$/ &&...
awk '1;length<=m && /[[:alpha:][:space:],]$/ && getline p{print (length(p)<=n?FS:RS) p}{print RS}' m=20 n=15 ORS= infile


In this case that should have been a-zA-Z or [:alpha:]. The latter is...
2,257
Posted By rangarasan
awk
Hi,

Try this one, There is little modification in my previous post.


awk -v inpf=35 -v inps=30 '{a[NR]=$0;}END{for(i=1;i<=NR;i++){f=length(a[i]);s=length(a[i+1]);if(f<inpf && s<inps && s!=0...
2,257
Posted By Scrutinizer
Try: awk '1;length<=m &&...
Try:
awk '1;length<=m && /[[:word:][:space:],]$/ && getline p{print (length(p)<=n?FS:RS) p}{print RS}' m=20 n=15 ORS= infile
2,257
Posted By rangarasan
awk
Hi,
Try this one,

awk -v inpf=35 -v inps=30 '{a[NR]=$0;}END{for(i=1;i<=NR;i++){f=length(a[i]);s=length(a[i+1]);if(f<inpf && s<inps && s!=0 && f!=0){ORS="";}else{ORS="\n";}print a[i];}}' file

...
2,257
Posted By anusurya
try this.......
$join = "join";
open ( FILE ,"$join") or $rc = 101;
while( <FILE> )
{
chomp($_);
$First = $_ if ( $_ =~ /\s$/ );
$length = length($_);
if ( $length == "20" )
{
next;
...
2,257
Posted By bmk
Try like... paste -d '' - - < test1.txt
Try like...
paste -d '' - - < test1.txt
7,472
Posted By Scrutinizer
Can it be that your file is in dos format? Try...
Can it be that your file is in dos format? Try converting it to unix format first:
tr -d '\r' < oldfile > newfile
7,472
Posted By balajesuri
perl -ne 'if (/^\s+/){print...
perl -ne 'if (/^\s+/){print "\n\n"}else{chomp;print "$_ "}' inputfile
7,472
Posted By tarun_agrawal
try this xargs -L 2 < filename.txt
try this


xargs -L 2 < filename.txt
7,472
Posted By Scrutinizer
I presume you mean the other way around.. See if...
I presume you mean the other way around.. See if this works:
awk '/[^[:punct:]],*$/{getline $(NF+1)}NF' infile
or perhaps even this (if every sentence is a paragraph that ends with an empty line).....
7,472
Posted By Scrutinizer
sed '/[^[:punct:]],*$/{N;s/\n/ /;}' infile awk...
sed '/[^[:punct:]],*$/{N;s/\n/ /;}' infile
awk '/[^[:punct:]],*$/{getline $(NF+1)}1' infile
7,472
Posted By complex.invoke
cat infilke | xargs -d '\n'
cat infilke | xargs -d '\n'
2,401
Posted By dude2cool
echo "this is-a hyphen,oh oh one more-hyphen"|sed...
echo "this is-a hyphen,oh oh one more-hyphen"|sed -r 's/(.*-.*)-/\1 /'

output:

this is-a hyphen,oh oh one more hyphen
Showing results 1 to 25 of 31

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