cat

unix: how to concatenate files matched in grep

*爱你&永不变心* 提交于 2019-12-12 13:51:39
问题 I want to concatenate the files whose name does not include "_BASE_". I thought it would be somewhere along the lines of ... ls | grep -v _BASE_ | cat > all.txt the cat part is what I am not getting right. Can anybody give me some idea about this? 回答1: Try this ls | grep -v _BASE_ | xargs cat > all.txt 回答2: You can ignore some files with ls using --ignore option and then cat them into a file. ls --ignore="*_BASE_*" | xargs cat > all.txt Also you can do that without xargs : cat $( ls --ignore=

Suppress Error message while using cat command

谁说我不能喝 提交于 2019-12-12 12:04:45
问题 I have a script where I recursively copy the contents of the files in a folder using cat command as follows test -f /tmp/$F || cat $F > /tmp/$F I get the following error cat: read error: Invalid argument I want to know how can I suppress this error. I only have access to shell interpreter (no bash). Thanks 回答1: Send error messages to /dev/null . cat $F 1>/tmp/$F 2>/dev/null 来源: https://stackoverflow.com/questions/27178935/suppress-error-message-while-using-cat-command

Run cat on remote computer and send output a variable using expect

天大地大妈咪最大 提交于 2019-12-12 09:28:16
问题 I have a bash+expect script which has to connect via ssh to the remote comp (and i can't use ssh keys, need password identification in here), read the file there, find specific line with the "hostname" (like "hostname aaaa1111") and store this hostname into the variable to be used after while. How can i get the value of the "hostname" parameter? I thought that line content will be in $expect_out(buffer) variable (so i can scan it and analyze), but it's not. My script is: #!/bin/bash ----bash

C - infinite read from cat in Device file

霸气de小男生 提交于 2019-12-12 04:51:57
问题 I've been having some headache with infinite reads from cat (cat doesn’t close because it doesn’t receive end of function from my read function. How can I implement an end of read so that reading the file with cat will only produce 1 output per command in the terminal? function. This is the kernel read() function I've written: static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *ppos) { char tmp_buf[MAX_BUF_SIZE]; //defined as 100 int bLen=0; sprintf(tmp_buf, "Some

awk - Find the top url based on error code

醉酒当歌 提交于 2019-12-12 04:24:12
问题 I am creating a sript to pre-analyze access logs from my website. So far I have been using awk to get desired data. I need to be able to use awk to analyze the top URL, but only for a specific error code. (In this case 404) Simplified log structure as follows: 'Request Method, URI, Error Code' GET, /foo, 404 GET, /foo, 200 GET, /foo, 404 GET, /foo, 404 GET, /bar, 200 GET, /bar, 404 GET, /foobar, 404 GET, /foobar, 404 My desired output would be (Listing top URLS that have 404 error Code): 3

Sorting and counting method faster then cat file | sort | uniq -c

ぐ巨炮叔叔 提交于 2019-12-12 02:58:00
问题 I have the following script that parses some | delimited field/value pairs. Sample data looks like |Apple=32.23|Banana =1232.12|Grape=12312|Pear=231|Grape=1231| I am just looking to count how many times A, B or C field names appear in the log file. The field list needs to be dynamic. Log files are 'big' about 500 megs each so it takes a while to sort each file. Is there a faster way to do the count once I do the cut and get a file with one field per line? cat /bb/logs/$dir/$file.txt | tr -s "

spring学习8-纯注解

无人久伴 提交于 2019-12-12 01:12:54
纯注解开发 pojo类 @Component public class User { @Value("cong") private String name; @Override public String toString() { return "User{" + "name='" + name + '\'' + '}'; } } 配置类 @Configuration//声明是一个配置类 @ComponentScan("com.cong")//用于通过注解指定spring在创建容器时要扫描的包 public class SpringConfig { } 测试 @Test public void test1(){ ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class); User user = (User) context.getBean("user"); System.out.println(user.toString()); } 引入其他配置文件 额外一个pojo类 public class Cat { private String name; public void setName(String name) { this.name = name; }

2019.12.11

我们两清 提交于 2019-12-11 18:44:40
Cat /etc/passwd UID--- 用户标识 号,它与用户名唯一对应。 LINUX中超级用户root的UID为0如果您想让系统显示您的用户名,UID,组名,GID以及您所属的其他组的名称,可利用id命令。修改UID一般用 usermod -u。 查看 cat /etc/shadow 新增加组 Groupadd + 组名字 添加用户 Chfn 可以更改用户的 finger 不允许远程登陆 Systemctl restar sshd.Service 该命令只适用 来源: https://www.cnblogs.com/y0620/p/12024383.html

ubuntu版本信息查看

二次信任 提交于 2019-12-11 16:00:23
1、cat /etc/issue 2、cat /etc/lsb-release 3、uname -a 4、cat /proc/version 5、lsb_release -a 显卡信息1、lspci | grep -i vga 查看显卡信息2、 nvidia-smi(显示一次当前GPU占用情况)nvidia-smi -l(每秒刷新一次并显示)watch -n 5 nvidia-smi (其中,5表示每隔6秒刷新一次终端的显示结果)    来源: https://www.cnblogs.com/cbugs/p/12022793.html

How to pass variables that are arguments in user defined functions to subfunctions in r

做~自己de王妃 提交于 2019-12-11 14:32:39
问题 I have a general problem in understanding how to create a user defined function that can accept variables as arguments that can be manipulated inside the defined function. I want to create a function in which I can pass variables as arguments to internal functions for manipulation. It appears that many of the functions I want to use require the c() operator which requires quotes around the arguments. So my function has to be able to pass the name of a variable from a dataframe into the quotes