Search Results

Search: Posts Made By: Priya Amaresh
Forum: Programming 04-02-2019
2,678
Posted By apmcd47
Try this: (Python 2.7.12 on Ubuntu 16.04 Xenial) ...
Try this: (Python 2.7.12 on Ubuntu 16.04 Xenial)

ss = system_info['Ad_List']
searchObj = "primary"
resList = [f for f in ss if searchObj in f]

resList will be a list of one object, or...
920
Posted By RavinderSingh13
Hello Priya Amaresh, Could you please try...
Hello Priya Amaresh,

Could you please try following and let me know if this helps you.

awk 'FNR==NR{A[$1];next} ($1 in A){print $0}' FS="=" executed.txt FS=" = " org_sysctl.txt

Output will...
1,049
Posted By RavinderSingh13
Hello andy391791, You could add a space...
Hello andy391791,

You could add a space in field separator else it will have spaces in the starting of the last field or 2nd field, so following should do the trick.

awk -F"= " '{print...
1,111
Posted By RudiC
No need to bother awk unless you are using a very...
No need to bother awk unless you are using a very old shell. With e.g. a recent bash, you could tryreplace="yyy.poweroff_cmd = 1"
[[ "${replace##* }" =~ [^0-9] ]] && echo string || echo number...
1,111
Posted By jim mcnamara
One way is to assume the number is not zero -...
One way is to assume the number is not zero - using awk (use this code for the two lines of shell you show)

replace1=$(awk ' int ($(NF) ) == 0 {continue } # int returns zero when $NF is a string ...
2,898
Posted By RavinderSingh13
Hello Priya, For editing the file in sed...
Hello Priya,

For editing the file in sed you could use following option for same.

sed -i 's/fruit/healthy &/' fruit.txt


Thanks,
R. Singh
1,626
Posted By Don Cragun
Try something like: #include <stdio.h> ...
Try something like:
#include <stdio.h>
#include <stdlib.h>

int main(int srgc, char *argv[ ])
{
char cmd[64];
int i;

for(i = 1; i < 50; i++) {
...
2,071
Posted By balajesuri
Using tr: [user@host ~]$ cat file | tr '\n' ' '...
Using tr:
[user@host ~]$ cat file | tr '\n' ' '
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 [user@host ~]$

Old school:
[user@host ~]$ while read line; do printf "%s " $line;...
956
Posted By krishmaths
Try the paste command paste file1 file2
Try the paste command

paste file1 file2
6,621
Posted By krishmaths
I missed to include the print instruction....
I missed to include the print instruction. Corrected in the below statement.

awk '{$2=";"}1' test.csv
6,621
Posted By vidyadhar85
why arent u using sed? sed 's/$/;/g'...
why arent u using sed?


sed 's/$/;/g' filename
3,419
Posted By vidyadhar85
My fav for this is.. awk...
My fav for this is..


awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=2 s="ACCOUNT" require.txt


b is number of lines above pattern and a is...
2,012
Posted By PikK45
The output is like this, ls ---> list all...
The output is like this,

ls ---> list all files & directories from the current directory

grep -e test ---> filter all files/directories with the name having "test" in it

NOTE: this output...
2,012
Posted By RudiC
$ ls test* test test~ $ ls | awk '/test/...
$ ls test*
test test~
$ ls | awk '/test/ {print $1; exit}'
test
2,141
Posted By Jotne
Is this the area you like to sum (in red)? ...
Is this the area you like to sum (in red)?

maths 2 0.0
english 2091 0.2
history -1 0.0 ...
9,851
Posted By Don Cragun
Hi Priya, I think everyone is missing the point...
Hi Priya,
I think everyone is missing the point of your problem. Although they are correct in pointing out that the exit status of a function call is not the appropriate way to return multiple...
1,556
Posted By MadeInGermany
tr ' ' '\n' < file awk '{print $1}' RS=" "...
tr ' ' '\n' < file
awk '{print $1}' RS=" " file
1,265
Posted By Yoda
I noticed that you used a lot of external...
I noticed that you used a lot of external utilities like cat, grep, awk, cut when most of these tasks can be done by shell built-ins.

Always use shell built-ins where ever possible, it will help...
5,805
Posted By Scott
Assuming "LINE" doesn't equal JAPAN and it...
Assuming "LINE" doesn't equal JAPAN and it doesn't equal - (hyphen), then it must be a number, then it's OK, otherwise not.

I don't have access to AIX now, so I suggest trying this first:

...
24,465
Posted By vidyadhar85
Why are you using two [ ? you have to use (.. ...
Why are you using two [ ? you have to use (..

Unix interpretes [ to test command
6,159
Posted By PikK45
Why go for NF when you have the columns fixed?? ...
Why go for NF when you have the columns fixed??

awk '{ print $2, $4}' file
3,408
Posted By hanson44
Because every line is printed. If all you want is...
Because every line is printed. If all you want is the totals, here is how to modify your code to print the desired result, the lines with five fields:
$ awk 'NF == 5 {print $2+$3+$4+$5}' marks.txt...
3,408
Posted By hanson44
Thanks for coming back on. Yes, the problem in...
Thanks for coming back on. Yes, the problem in your code seems to be on that long line with the two awk statements. Instead of trying to fix that logic, try this approach and see if it does what you...
15,114
Posted By sam05121988
string1="Hi, How are you?" echo "$string1 is...
string1="Hi, How are you?"
echo "$string1 is the value"
replace1="Am fine\nWhat are you doing?"
echo "$replace1 is the value"
sed -e "s/$string1/$replace1/g" file > file_new
this can be done...
2,668
Posted By chacko193
I think here you are renaming the file to...
I think here you are renaming the file to partition.[0-9]_org.So when you try using the RE,it won't find any file.

Better use

mv $toMove "$toMove"_org

instead of

mv $toMove...
Showing results 1 to 25 of 30

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